@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,169 +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
- import { type Editor, Plugin } from 'ckeditor5/src/core.js';
6
- import EmojiUtils from './emojiutils.js';
7
- import type { SkinToneId } from './emojiconfig.js';
8
- /**
9
- * The emoji repository plugin.
10
- *
11
- * Loads the emoji repository from URL during plugin initialization and provides utility methods to search it.
12
- */
13
- export default class EmojiRepository extends Plugin {
14
- /**
15
- * A callback to resolve the {@link #_repositoryPromise} to control the return value of this promise.
16
- */
17
- private _repositoryPromiseResolveCallback;
18
- /**
19
- * An instance of the [Fuse.js](https://www.fusejs.io/) library.
20
- */
21
- private _fuseSearch;
22
- /**
23
- * The resolved URL from which the emoji repository is downloaded.
24
- */
25
- private readonly _url;
26
- /**
27
- * A promise resolved after downloading the emoji collection.
28
- * The promise resolves with `true` when the repository is successfully downloaded or `false` otherwise.
29
- */
30
- private readonly _repositoryPromise;
31
- /**
32
- * @inheritDoc
33
- */
34
- static get requires(): readonly [typeof EmojiUtils];
35
- /**
36
- * @inheritDoc
37
- */
38
- static get pluginName(): "EmojiRepository";
39
- /**
40
- * @inheritDoc
41
- */
42
- static get isOfficialPlugin(): true;
43
- /**
44
- * @inheritDoc
45
- */
46
- constructor(editor: Editor);
47
- /**
48
- * @inheritDoc
49
- */
50
- init(): Promise<void>;
51
- /**
52
- * Returns an array of emoji entries that match the search query.
53
- * If the emoji repository is not loaded, the [Fuse.js](https://www.fusejs.io/) instance is not created,
54
- * hence this method returns an empty array.
55
- *
56
- * @param searchQuery A search query to match emoji.
57
- * @returns An array of emoji entries that match the search query.
58
- */
59
- getEmojiByQuery(searchQuery: string): Array<EmojiEntry>;
60
- /**
61
- * Groups all emojis by categories.
62
- * If the emoji repository is not loaded, it returns an empty array.
63
- *
64
- * @returns An array of emoji entries grouped by categories.
65
- */
66
- getEmojiCategories(): Array<EmojiCategory>;
67
- /**
68
- * Returns an array of available skin tones.
69
- */
70
- getSkinTones(): Array<SkinTone>;
71
- /**
72
- * Indicates whether the emoji repository has been successfully downloaded and the plugin is operational.
73
- */
74
- isReady(): Promise<boolean>;
75
- /**
76
- * Returns the URL from which the emoji repository is downloaded. If the URL is not provided
77
- * in the configuration, the default URL is used with the version from the configuration.
78
- *
79
- * If both the URL and version are provided, a warning is logged.
80
- */
81
- private _getUrl;
82
- /**
83
- * Warn users on self-hosted installations that this plugin uses a CDN to fetch the emoji repository.
84
- */
85
- private _warnAboutCdnUse;
86
- /**
87
- * Returns the emoji repository in a configured version if it is a non-empty array. Returns `null` otherwise.
88
- */
89
- private _getItems;
90
- /**
91
- * Loads the emoji repository. If the repository is already loaded, it returns the cached result.
92
- * Otherwise, it fetches the repository from the URL and adds it to the cache.
93
- */
94
- private _loadAndCacheEmoji;
95
- /**
96
- * Normalizes the raw data fetched from CDN. By normalization, we meant:
97
- *
98
- * * Filter out unsupported emoji (these that will not render correctly),
99
- * * Prepare skin tone variants if an emoji defines them.
100
- */
101
- private _normalizeEmoji;
102
- /**
103
- * Versioned emoji repository.
104
- */
105
- private static _results;
106
- }
107
- /**
108
- * Represents a single group of the emoji category, e.g., "Smileys & Expressions".
109
- */
110
- export type EmojiCategory = {
111
- /**
112
- * A name of the category.
113
- */
114
- title: string;
115
- /**
116
- * An example emoji representing items belonging to the category.
117
- */
118
- icon: string;
119
- /**
120
- * Group id used to assign {@link #items}.
121
- */
122
- groupId: number;
123
- /**
124
- * An array of emojis.
125
- */
126
- items: Array<EmojiEntry>;
127
- };
128
- /**
129
- * Represents a single item fetched from the CDN.
130
- */
131
- export type EmojiCdnResource = {
132
- annotation: string;
133
- emoji: string;
134
- group: number;
135
- order: number;
136
- version: number;
137
- emoticon?: string;
138
- shortcodes?: Array<string>;
139
- skins?: Array<{
140
- emoji: string;
141
- tone: number;
142
- version: number;
143
- }>;
144
- tags?: Array<string>;
145
- };
146
- /**
147
- * Represents a single emoji item used by the emoji feature.
148
- */
149
- export type EmojiEntry = Omit<EmojiCdnResource, 'skins'> & {
150
- skins: EmojiMap;
151
- };
152
- /**
153
- * Represents mapping between a skin tone and its corresponding emoji.
154
- *
155
- * The `default` key is always present. Additional values are assigned only if an emoji supports skin tones.
156
- */
157
- export type EmojiMap = {
158
- [K in Exclude<SkinToneId, 'default'>]?: string;
159
- } & {
160
- default: string;
161
- };
162
- /**
163
- * Represents an emoji skin tone variant.
164
- */
165
- export type SkinTone = {
166
- id: SkinToneId;
167
- icon: string;
168
- tooltip: string;
169
- };
@@ -1,290 +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/emojirepository
7
- */
8
- import Fuse from 'fuse.js';
9
- import { groupBy } from 'lodash-es';
10
- import { Plugin } from 'ckeditor5/src/core.js';
11
- import { logWarning, version as editorVersion } from 'ckeditor5/src/utils.js';
12
- import EmojiUtils from './emojiutils.js';
13
- // An endpoint from which the emoji data will be downloaded during plugin initialization.
14
- // The `{version}` placeholder is replaced with the value from editor config.
15
- const DEFAULT_EMOJI_DATABASE_URL = 'https://cdn.ckeditor.com/ckeditor5/data/emoji/{version}/en.json';
16
- const DEFAULT_EMOJI_VERSION = 16;
17
- /**
18
- * The emoji repository plugin.
19
- *
20
- * Loads the emoji repository from URL during plugin initialization and provides utility methods to search it.
21
- */
22
- class EmojiRepository extends Plugin {
23
- /**
24
- * @inheritDoc
25
- */
26
- static get requires() {
27
- return [EmojiUtils];
28
- }
29
- /**
30
- * @inheritDoc
31
- */
32
- static get pluginName() {
33
- return 'EmojiRepository';
34
- }
35
- /**
36
- * @inheritDoc
37
- */
38
- static get isOfficialPlugin() {
39
- return true;
40
- }
41
- /**
42
- * @inheritDoc
43
- */
44
- constructor(editor) {
45
- super(editor);
46
- editor.config.define('emoji', {
47
- version: undefined,
48
- skinTone: 'default',
49
- definitionsUrl: undefined
50
- });
51
- this._url = this._getUrl();
52
- this._repositoryPromise = new Promise(resolve => {
53
- this._repositoryPromiseResolveCallback = resolve;
54
- });
55
- this._fuseSearch = null;
56
- }
57
- /**
58
- * @inheritDoc
59
- */
60
- async init() {
61
- this._warnAboutCdnUse();
62
- await this._loadAndCacheEmoji();
63
- const items = this._getItems();
64
- // Skip plugin initialization if the emoji repository is not available.
65
- // The initialization of other dependent plugins, such as `EmojiMention` and `EmojiPicker`, is prevented as well.
66
- if (!items) {
67
- return this._repositoryPromiseResolveCallback(false);
68
- }
69
- // Create instance of the Fuse.js library with configured weighted search keys and disabled fuzzy search.
70
- this._fuseSearch = new Fuse(items, {
71
- keys: [
72
- { name: 'emoticon', weight: 5 },
73
- { name: 'annotation', weight: 3 },
74
- { name: 'tags', weight: 1 }
75
- ],
76
- minMatchCharLength: 2,
77
- threshold: 0,
78
- ignoreLocation: true
79
- });
80
- return this._repositoryPromiseResolveCallback(true);
81
- }
82
- /**
83
- * Returns an array of emoji entries that match the search query.
84
- * If the emoji repository is not loaded, the [Fuse.js](https://www.fusejs.io/) instance is not created,
85
- * hence this method returns an empty array.
86
- *
87
- * @param searchQuery A search query to match emoji.
88
- * @returns An array of emoji entries that match the search query.
89
- */
90
- getEmojiByQuery(searchQuery) {
91
- if (!this._fuseSearch) {
92
- return [];
93
- }
94
- const searchQueryTokens = searchQuery.split(/\s/).filter(Boolean);
95
- // Perform the search only if there is at least two non-white characters next to each other.
96
- const shouldSearch = searchQueryTokens.some(token => token.length >= 2);
97
- if (!shouldSearch) {
98
- return [];
99
- }
100
- return this._fuseSearch
101
- .search({
102
- '$or': [
103
- {
104
- emoticon: searchQuery
105
- },
106
- {
107
- '$and': searchQueryTokens.map(token => ({ annotation: token }))
108
- },
109
- {
110
- '$and': searchQueryTokens.map(token => ({ tags: token }))
111
- }
112
- ]
113
- })
114
- .map(result => result.item);
115
- }
116
- /**
117
- * Groups all emojis by categories.
118
- * If the emoji repository is not loaded, it returns an empty array.
119
- *
120
- * @returns An array of emoji entries grouped by categories.
121
- */
122
- getEmojiCategories() {
123
- const repository = this._getItems();
124
- if (!repository) {
125
- return [];
126
- }
127
- const { t } = this.editor.locale;
128
- const categories = [
129
- { title: t('Smileys & Expressions'), icon: '😀', groupId: 0 },
130
- { title: t('Gestures & People'), icon: '👋', groupId: 1 },
131
- { title: t('Animals & Nature'), icon: '🐻', groupId: 3 },
132
- { title: t('Food & Drinks'), icon: '🍎', groupId: 4 },
133
- { title: t('Travel & Places'), icon: '🚘', groupId: 5 },
134
- { title: t('Activities'), icon: '🏀', groupId: 6 },
135
- { title: t('Objects'), icon: '💡', groupId: 7 },
136
- { title: t('Symbols'), icon: '🟢', groupId: 8 },
137
- { title: t('Flags'), icon: '🏁', groupId: 9 }
138
- ];
139
- const groups = groupBy(repository, 'group');
140
- return categories.map(category => {
141
- return {
142
- ...category,
143
- items: groups[category.groupId]
144
- };
145
- });
146
- }
147
- /**
148
- * Returns an array of available skin tones.
149
- */
150
- getSkinTones() {
151
- const { t } = this.editor.locale;
152
- return [
153
- { id: 'default', icon: '👋', tooltip: t('Default skin tone') },
154
- { id: 'light', icon: '👋🏻', tooltip: t('Light skin tone') },
155
- { id: 'medium-light', icon: '👋🏼', tooltip: t('Medium Light skin tone') },
156
- { id: 'medium', icon: '👋🏽', tooltip: t('Medium skin tone') },
157
- { id: 'medium-dark', icon: '👋🏾', tooltip: t('Medium Dark skin tone') },
158
- { id: 'dark', icon: '👋🏿', tooltip: t('Dark skin tone') }
159
- ];
160
- }
161
- /**
162
- * Indicates whether the emoji repository has been successfully downloaded and the plugin is operational.
163
- */
164
- isReady() {
165
- return this._repositoryPromise;
166
- }
167
- /**
168
- * Returns the URL from which the emoji repository is downloaded. If the URL is not provided
169
- * in the configuration, the default URL is used with the version from the configuration.
170
- *
171
- * If both the URL and version are provided, a warning is logged.
172
- */
173
- _getUrl() {
174
- const { definitionsUrl, version } = this.editor.config.get('emoji');
175
- if (!definitionsUrl || definitionsUrl === 'cdn') {
176
- // URL was not provided or is set to 'cdn', so we use the default CDN URL.
177
- const urlVersion = version || DEFAULT_EMOJI_VERSION;
178
- const url = new URL(DEFAULT_EMOJI_DATABASE_URL.replace('{version}', urlVersion.toString()));
179
- url.searchParams.set('editorVersion', editorVersion);
180
- return url;
181
- }
182
- if (version) {
183
- /**
184
- * Both {@link module:emoji/emojiconfig~EmojiConfig#definitionsUrl `emoji.definitionsUrl`} and
185
- * {@link module:emoji/emojiconfig~EmojiConfig#version `emoji.version`} configuration options
186
- * are set. Only the `emoji.definitionsUrl` option will be used.
187
- *
188
- * The `emoji.version` option will be ignored and should be removed from the configuration.
189
- *
190
- * @error emoji-repository-redundant-version
191
- */
192
- logWarning('emoji-repository-redundant-version');
193
- }
194
- return new URL(definitionsUrl);
195
- }
196
- /**
197
- * Warn users on self-hosted installations that this plugin uses a CDN to fetch the emoji repository.
198
- */
199
- _warnAboutCdnUse() {
200
- const editor = this.editor;
201
- const config = editor.config.get('emoji');
202
- const licenseKey = editor.config.get('licenseKey');
203
- const distributionChannel = window[Symbol.for('cke distribution')];
204
- if (licenseKey === 'GPL') {
205
- // Don't warn GPL users.
206
- return;
207
- }
208
- if (distributionChannel === 'cloud') {
209
- // Don't warn cloud users, because they already use our CDN.
210
- return;
211
- }
212
- if (config && config.definitionsUrl) {
213
- // Don't warn users who have configured their own definitions URL.
214
- return;
215
- }
216
- /**
217
- * By default, the Emoji plugin fetches the emoji repository from CKEditor 5 CDN. To avoid this,
218
- * you can use the {@link module:emoji/emojiconfig~EmojiConfig#definitionsUrl `emoji.definitionsUrl`}
219
- * configuration option to provide a URL to your own emoji repository.
220
- *
221
- * If you only want to suppress this warning, set this configuration option to `cdn`.
222
- *
223
- * @error emoji-repository-cdn-use
224
- */
225
- logWarning('emoji-repository-cdn-use');
226
- }
227
- /**
228
- * Returns the emoji repository in a configured version if it is a non-empty array. Returns `null` otherwise.
229
- */
230
- _getItems() {
231
- const repository = EmojiRepository._results[this._url.href];
232
- return repository && repository.length ? repository : null;
233
- }
234
- /**
235
- * Loads the emoji repository. If the repository is already loaded, it returns the cached result.
236
- * Otherwise, it fetches the repository from the URL and adds it to the cache.
237
- */
238
- async _loadAndCacheEmoji() {
239
- if (EmojiRepository._results[this._url.href]) {
240
- // The repository has already been downloaded.
241
- return;
242
- }
243
- const result = await fetch(this._url, { cache: 'force-cache' })
244
- .then(response => {
245
- if (!response.ok) {
246
- return [];
247
- }
248
- return response.json();
249
- })
250
- .catch(() => {
251
- return [];
252
- });
253
- if (!result.length) {
254
- /**
255
- * Unable to load the emoji repository from the URL.
256
- *
257
- * If the URL works properly and there is no disruption of communication, please check your
258
- * {@glink getting-started/setup/csp Content Security Policy (CSP)} setting and make sure
259
- * the URL connection is allowed by the editor.
260
- *
261
- * @error emoji-repository-load-failed
262
- */
263
- logWarning('emoji-repository-load-failed');
264
- }
265
- EmojiRepository._results[this._url.href] = this._normalizeEmoji(result);
266
- }
267
- /**
268
- * Normalizes the raw data fetched from CDN. By normalization, we meant:
269
- *
270
- * * Filter out unsupported emoji (these that will not render correctly),
271
- * * Prepare skin tone variants if an emoji defines them.
272
- */
273
- _normalizeEmoji(data) {
274
- const emojiUtils = this.editor.plugins.get('EmojiUtils');
275
- const emojiSupportedVersionByOs = emojiUtils.getEmojiSupportedVersionByOs();
276
- const container = emojiUtils.createEmojiWidthTestingContainer();
277
- document.body.appendChild(container);
278
- const results = data
279
- .filter(item => emojiUtils.isEmojiCategoryAllowed(item))
280
- .filter(item => emojiUtils.isEmojiSupported(item, emojiSupportedVersionByOs, container))
281
- .map(item => emojiUtils.normalizeEmojiSkinTone(item));
282
- container.remove();
283
- return results;
284
- }
285
- }
286
- /**
287
- * Versioned emoji repository.
288
- */
289
- EmojiRepository._results = {};
290
- export default EmojiRepository;
@@ -1,58 +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
- import { Plugin } from 'ckeditor5/src/core.js';
6
- import type { EmojiCdnResource, EmojiEntry } from './emojirepository.js';
7
- /**
8
- * The Emoji utilities plugin.
9
- */
10
- export default class EmojiUtils extends Plugin {
11
- /**
12
- * @inheritDoc
13
- */
14
- static get pluginName(): "EmojiUtils";
15
- /**
16
- * @inheritDoc
17
- */
18
- static get isOfficialPlugin(): true;
19
- /**
20
- * Checks if the emoji is supported by verifying the emoji version supported by the system first.
21
- * Then checks if emoji contains a zero width joiner (ZWJ), and if yes, then checks if it is supported by the system.
22
- */
23
- isEmojiSupported(item: EmojiCdnResource, emojiSupportedVersionByOs: number, container: HTMLDivElement): boolean;
24
- /**
25
- * Checks the supported emoji version by the OS, by sampling some representatives from different emoji releases.
26
- */
27
- getEmojiSupportedVersionByOs(): number;
28
- /**
29
- * Check for ZWJ (zero width joiner) character.
30
- */
31
- hasZwj(emoji: string): boolean;
32
- /**
33
- * Checks whether the emoji is supported in the operating system.
34
- */
35
- isEmojiZwjSupported(item: EmojiCdnResource, container: HTMLDivElement): boolean;
36
- /**
37
- * Returns the width of the provided node.
38
- */
39
- getNodeWidth(container: HTMLDivElement, node: string): number;
40
- /**
41
- * Creates a div for emoji width testing purposes.
42
- */
43
- createEmojiWidthTestingContainer(): HTMLDivElement;
44
- /**
45
- * Adds default skin tone property to each emoji. If emoji defines other skin tones, they are added as well.
46
- */
47
- normalizeEmojiSkinTone(item: EmojiCdnResource): EmojiEntry;
48
- /**
49
- * Checks whether the emoji belongs to a group that is allowed.
50
- */
51
- isEmojiCategoryAllowed(item: EmojiCdnResource): boolean;
52
- /**
53
- * A function used to determine if emoji is supported by detecting pixels.
54
- *
55
- * Referenced for unit testing purposes. Kept in a separate file because of licensing.
56
- */
57
- private static _isEmojiSupported;
58
- }
package/src/emojiutils.js DELETED
@@ -1,141 +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
- import { Plugin } from 'ckeditor5/src/core.js';
6
- import isEmojiSupported from './utils/isemojisupported.js';
7
- /**
8
- * @module emoji/emojiutils
9
- */
10
- const SKIN_TONE_MAP = {
11
- 0: 'default',
12
- 1: 'light',
13
- 2: 'medium-light',
14
- 3: 'medium',
15
- 4: 'medium-dark',
16
- 5: 'dark'
17
- };
18
- /**
19
- * A map representing an emoji and its release version.
20
- * It's used to identify a user's minimal supported emoji level.
21
- */
22
- const EMOJI_SUPPORT_LEVEL = {
23
- '🫩': 16,
24
- '🫨': 15.1 // Shaking head. Although the version of emoji is 15, it is used to detect versions 15 and 15.1.
25
- };
26
- const BASELINE_EMOJI_WIDTH = 24;
27
- /**
28
- * The Emoji utilities plugin.
29
- */
30
- class EmojiUtils extends Plugin {
31
- /**
32
- * @inheritDoc
33
- */
34
- static get pluginName() {
35
- return 'EmojiUtils';
36
- }
37
- /**
38
- * @inheritDoc
39
- */
40
- static get isOfficialPlugin() {
41
- return true;
42
- }
43
- /**
44
- * Checks if the emoji is supported by verifying the emoji version supported by the system first.
45
- * Then checks if emoji contains a zero width joiner (ZWJ), and if yes, then checks if it is supported by the system.
46
- */
47
- isEmojiSupported(item, emojiSupportedVersionByOs, container) {
48
- const isEmojiVersionSupported = item.version <= emojiSupportedVersionByOs;
49
- if (!isEmojiVersionSupported) {
50
- return false;
51
- }
52
- if (!this.hasZwj(item.emoji)) {
53
- return true;
54
- }
55
- return this.isEmojiZwjSupported(item, container);
56
- }
57
- /**
58
- * Checks the supported emoji version by the OS, by sampling some representatives from different emoji releases.
59
- */
60
- getEmojiSupportedVersionByOs() {
61
- return Object.entries(EMOJI_SUPPORT_LEVEL)
62
- .reduce((currentVersion, [emoji, newVersion]) => {
63
- if (newVersion > currentVersion && EmojiUtils._isEmojiSupported(emoji)) {
64
- return newVersion;
65
- }
66
- return currentVersion;
67
- }, 0);
68
- }
69
- /**
70
- * Check for ZWJ (zero width joiner) character.
71
- */
72
- hasZwj(emoji) {
73
- return emoji.includes('\u200d');
74
- }
75
- /**
76
- * Checks whether the emoji is supported in the operating system.
77
- */
78
- isEmojiZwjSupported(item, container) {
79
- const emojiWidth = this.getNodeWidth(container, item.emoji);
80
- // On Windows, some supported emoji are ~50% bigger than the baseline emoji, but what we really want to guard
81
- // against are the ones that are 2x the size, because those are truly broken (person with red hair = person with
82
- // floating red wig, black cat = cat with black square, polar bear = bear with snowflake, etc.)
83
- // So here we set the threshold at 1.8 times the size of the baseline emoji.
84
- return emojiWidth < BASELINE_EMOJI_WIDTH * 1.8;
85
- }
86
- /**
87
- * Returns the width of the provided node.
88
- */
89
- getNodeWidth(container, node) {
90
- const span = document.createElement('span');
91
- span.textContent = node;
92
- container.appendChild(span);
93
- const nodeWidth = span.offsetWidth;
94
- container.removeChild(span);
95
- return nodeWidth;
96
- }
97
- /**
98
- * Creates a div for emoji width testing purposes.
99
- */
100
- createEmojiWidthTestingContainer() {
101
- const container = document.createElement('div');
102
- container.setAttribute('aria-hidden', 'true');
103
- container.style.position = 'absolute';
104
- container.style.left = '-9999px';
105
- container.style.whiteSpace = 'nowrap';
106
- container.style.fontSize = BASELINE_EMOJI_WIDTH + 'px';
107
- return container;
108
- }
109
- /**
110
- * Adds default skin tone property to each emoji. If emoji defines other skin tones, they are added as well.
111
- */
112
- normalizeEmojiSkinTone(item) {
113
- const entry = {
114
- ...item,
115
- skins: {
116
- default: item.emoji
117
- }
118
- };
119
- if (item.skins) {
120
- item.skins.forEach(skin => {
121
- const skinTone = SKIN_TONE_MAP[skin.tone];
122
- entry.skins[skinTone] = skin.emoji;
123
- });
124
- }
125
- return entry;
126
- }
127
- /**
128
- * Checks whether the emoji belongs to a group that is allowed.
129
- */
130
- isEmojiCategoryAllowed(item) {
131
- // Category group=2 contains skin tones only, which we do not want to render.
132
- return item.group !== 2;
133
- }
134
- }
135
- /**
136
- * A function used to determine if emoji is supported by detecting pixels.
137
- *
138
- * Referenced for unit testing purposes. Kept in a separate file because of licensing.
139
- */
140
- EmojiUtils._isEmojiSupported = isEmojiSupported;
141
- export default EmojiUtils;
package/src/index.d.ts DELETED
@@ -1,15 +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
7
- */
8
- export { default as Emoji } from './emoji.js';
9
- export { default as EmojiMention } from './emojimention.js';
10
- export { default as EmojiPicker } from './emojipicker.js';
11
- export { default as EmojiRepository } from './emojirepository.js';
12
- export { default as EmojiUtils } from './emojiutils.js';
13
- export { default as EmojiCommand } from './emojicommand.js';
14
- export type { EmojiConfig } from './emojiconfig.js';
15
- import './augmentation.js';
package/src/index.js DELETED
@@ -1,14 +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
7
- */
8
- export { default as Emoji } from './emoji.js';
9
- export { default as EmojiMention } from './emojimention.js';
10
- export { default as EmojiPicker } from './emojipicker.js';
11
- export { default as EmojiRepository } from './emojirepository.js';
12
- export { default as EmojiUtils } from './emojiutils.js';
13
- export { default as EmojiCommand } from './emojicommand.js';
14
- import './augmentation.js';