@ckeditor/ckeditor5-emoji 44.2.0-alpha.1 → 44.2.0-alpha.10

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 (177) hide show
  1. package/LICENSE.md +1 -0
  2. package/build/emoji.js +1 -1
  3. package/build/translations/ar.js +1 -1
  4. package/build/translations/bg.js +1 -1
  5. package/build/translations/bn.js +1 -1
  6. package/build/translations/ca.js +1 -1
  7. package/build/translations/cs.js +1 -1
  8. package/build/translations/da.js +1 -1
  9. package/build/translations/de.js +1 -1
  10. package/build/translations/el.js +1 -1
  11. package/build/translations/es.js +1 -1
  12. package/build/translations/et.js +1 -1
  13. package/build/translations/fi.js +1 -1
  14. package/build/translations/fr.js +1 -1
  15. package/build/translations/he.js +1 -1
  16. package/build/translations/hi.js +1 -1
  17. package/build/translations/hu.js +1 -1
  18. package/build/translations/id.js +1 -1
  19. package/build/translations/it.js +1 -1
  20. package/build/translations/ja.js +1 -1
  21. package/build/translations/ko.js +1 -1
  22. package/build/translations/lt.js +1 -1
  23. package/build/translations/lv.js +1 -1
  24. package/build/translations/ms.js +1 -1
  25. package/build/translations/nl.js +1 -1
  26. package/build/translations/no.js +1 -1
  27. package/build/translations/pl.js +1 -1
  28. package/build/translations/pt-br.js +1 -1
  29. package/build/translations/pt.js +1 -1
  30. package/build/translations/ro.js +1 -1
  31. package/build/translations/ru.js +1 -1
  32. package/build/translations/sk.js +1 -1
  33. package/build/translations/sr.js +1 -1
  34. package/build/translations/sv.js +1 -1
  35. package/build/translations/th.js +1 -1
  36. package/build/translations/tr.js +1 -1
  37. package/build/translations/uk.js +1 -1
  38. package/build/translations/vi.js +1 -1
  39. package/build/translations/zh-cn.js +1 -1
  40. package/build/translations/zh.js +1 -1
  41. package/ckeditor5-metadata.json +15 -2
  42. package/dist/index-editor.css +1 -1
  43. package/dist/index.css +1 -1
  44. package/dist/index.css.map +1 -1
  45. package/dist/index.js +312 -154
  46. package/dist/index.js.map +1 -1
  47. package/dist/translations/ar.js +1 -1
  48. package/dist/translations/ar.umd.js +1 -1
  49. package/dist/translations/bg.js +1 -1
  50. package/dist/translations/bg.umd.js +1 -1
  51. package/dist/translations/bn.js +1 -1
  52. package/dist/translations/bn.umd.js +1 -1
  53. package/dist/translations/ca.js +1 -1
  54. package/dist/translations/ca.umd.js +1 -1
  55. package/dist/translations/cs.js +1 -1
  56. package/dist/translations/cs.umd.js +1 -1
  57. package/dist/translations/da.js +1 -1
  58. package/dist/translations/da.umd.js +1 -1
  59. package/dist/translations/de.js +1 -1
  60. package/dist/translations/de.umd.js +1 -1
  61. package/dist/translations/el.js +1 -1
  62. package/dist/translations/el.umd.js +1 -1
  63. package/dist/translations/es.js +1 -1
  64. package/dist/translations/es.umd.js +1 -1
  65. package/dist/translations/et.js +1 -1
  66. package/dist/translations/et.umd.js +1 -1
  67. package/dist/translations/fi.js +1 -1
  68. package/dist/translations/fi.umd.js +1 -1
  69. package/dist/translations/fr.js +1 -1
  70. package/dist/translations/fr.umd.js +1 -1
  71. package/dist/translations/he.js +1 -1
  72. package/dist/translations/he.umd.js +1 -1
  73. package/dist/translations/hi.js +1 -1
  74. package/dist/translations/hi.umd.js +1 -1
  75. package/dist/translations/hu.js +1 -1
  76. package/dist/translations/hu.umd.js +1 -1
  77. package/dist/translations/id.js +1 -1
  78. package/dist/translations/id.umd.js +1 -1
  79. package/dist/translations/it.js +1 -1
  80. package/dist/translations/it.umd.js +1 -1
  81. package/dist/translations/ja.js +1 -1
  82. package/dist/translations/ja.umd.js +1 -1
  83. package/dist/translations/ko.js +1 -1
  84. package/dist/translations/ko.umd.js +1 -1
  85. package/dist/translations/lt.js +1 -1
  86. package/dist/translations/lt.umd.js +1 -1
  87. package/dist/translations/lv.js +1 -1
  88. package/dist/translations/lv.umd.js +1 -1
  89. package/dist/translations/ms.js +1 -1
  90. package/dist/translations/ms.umd.js +1 -1
  91. package/dist/translations/nl.js +1 -1
  92. package/dist/translations/nl.umd.js +1 -1
  93. package/dist/translations/no.js +1 -1
  94. package/dist/translations/no.umd.js +1 -1
  95. package/dist/translations/pl.js +1 -1
  96. package/dist/translations/pl.umd.js +1 -1
  97. package/dist/translations/pt-br.js +1 -1
  98. package/dist/translations/pt-br.umd.js +1 -1
  99. package/dist/translations/pt.js +1 -1
  100. package/dist/translations/pt.umd.js +1 -1
  101. package/dist/translations/ro.js +1 -1
  102. package/dist/translations/ro.umd.js +1 -1
  103. package/dist/translations/ru.js +1 -1
  104. package/dist/translations/ru.umd.js +1 -1
  105. package/dist/translations/sk.js +1 -1
  106. package/dist/translations/sk.umd.js +1 -1
  107. package/dist/translations/sr.js +1 -1
  108. package/dist/translations/sr.umd.js +1 -1
  109. package/dist/translations/sv.js +1 -1
  110. package/dist/translations/sv.umd.js +1 -1
  111. package/dist/translations/th.js +1 -1
  112. package/dist/translations/th.umd.js +1 -1
  113. package/dist/translations/tr.js +1 -1
  114. package/dist/translations/tr.umd.js +1 -1
  115. package/dist/translations/uk.js +1 -1
  116. package/dist/translations/uk.umd.js +1 -1
  117. package/dist/translations/vi.js +1 -1
  118. package/dist/translations/vi.umd.js +1 -1
  119. package/dist/translations/zh-cn.js +1 -1
  120. package/dist/translations/zh-cn.umd.js +1 -1
  121. package/dist/translations/zh.js +1 -1
  122. package/dist/translations/zh.umd.js +1 -1
  123. package/lang/translations/ar.po +22 -22
  124. package/lang/translations/bg.po +22 -22
  125. package/lang/translations/bn.po +22 -22
  126. package/lang/translations/ca.po +22 -22
  127. package/lang/translations/cs.po +22 -22
  128. package/lang/translations/da.po +22 -22
  129. package/lang/translations/de.po +22 -22
  130. package/lang/translations/el.po +22 -22
  131. package/lang/translations/es.po +22 -22
  132. package/lang/translations/et.po +22 -22
  133. package/lang/translations/fi.po +22 -22
  134. package/lang/translations/fr.po +22 -22
  135. package/lang/translations/he.po +22 -22
  136. package/lang/translations/hi.po +22 -22
  137. package/lang/translations/hu.po +22 -22
  138. package/lang/translations/id.po +22 -22
  139. package/lang/translations/it.po +22 -22
  140. package/lang/translations/ja.po +22 -22
  141. package/lang/translations/ko.po +22 -22
  142. package/lang/translations/lt.po +22 -22
  143. package/lang/translations/lv.po +22 -22
  144. package/lang/translations/ms.po +22 -22
  145. package/lang/translations/nl.po +22 -22
  146. package/lang/translations/no.po +22 -22
  147. package/lang/translations/pl.po +22 -22
  148. package/lang/translations/pt-br.po +22 -22
  149. package/lang/translations/pt.po +22 -22
  150. package/lang/translations/ro.po +22 -22
  151. package/lang/translations/ru.po +22 -22
  152. package/lang/translations/sk.po +22 -22
  153. package/lang/translations/sr.po +22 -22
  154. package/lang/translations/sv.po +22 -22
  155. package/lang/translations/th.po +22 -22
  156. package/lang/translations/tr.po +22 -22
  157. package/lang/translations/uk.po +22 -22
  158. package/lang/translations/vi.po +22 -22
  159. package/lang/translations/zh-cn.po +22 -22
  160. package/lang/translations/zh.po +22 -22
  161. package/package.json +7 -7
  162. package/src/augmentation.d.ts +2 -1
  163. package/src/emojiconfig.d.ts +2 -1
  164. package/src/emojimention.d.ts +13 -6
  165. package/src/emojimention.js +39 -26
  166. package/src/emojipicker.d.ts +3 -3
  167. package/src/emojipicker.js +14 -14
  168. package/src/emojirepository.d.ts +35 -17
  169. package/src/emojirepository.js +86 -126
  170. package/src/emojiutils.d.ts +58 -0
  171. package/src/emojiutils.js +141 -0
  172. package/src/index.d.ts +1 -0
  173. package/src/index.js +1 -0
  174. package/src/ui/emojipickerview.js +1 -0
  175. package/src/utils/isemojisupported.d.ts +11 -0
  176. package/src/utils/isemojisupported.js +68 -0
  177. package/theme/emojigrid.css +1 -1
@@ -13,88 +13,88 @@ msgstr ""
13
13
 
14
14
  msgctxt "Toolbar button tooltip for the Emoji feature."
15
15
  msgid "Emoji"
16
- msgstr ""
16
+ msgstr "表情符號"
17
17
 
18
18
  msgctxt "Dropdown option label for opening an emoji picker offering more results to choose from."
19
19
  msgid "Show all emoji..."
20
- msgstr ""
20
+ msgstr "顯示所有表情符號…"
21
21
 
22
22
  msgctxt "Label of an input field for filtering an emoji collection by the typed value."
23
23
  msgid "Find an emoji (min. 2 characters)"
24
- msgstr ""
24
+ msgstr "尋找表情符號(最少 2 個字元)"
25
25
 
26
26
  msgctxt "The main text of the message shown to the user when no emoji are available for the search criteria."
27
27
  msgid "No emojis were found matching \"%0\"."
28
- msgstr ""
28
+ msgstr "找不到與「%0」相符的表情符號。"
29
29
 
30
30
  msgctxt "The main text of the message shown to the user when the provided search query does not contain the required number of characters."
31
31
  msgid "Keep on typing to see the emoji."
32
- msgstr ""
32
+ msgstr "繼續輸入以查看表情符號。"
33
33
 
34
34
  msgctxt "The secondary text of the message shown to the user to explain how many characters the search query must consist of."
35
35
  msgid "The query must contain at least two characters."
36
- msgstr ""
36
+ msgstr "查詢條件至少須包含兩個字元。"
37
37
 
38
38
  msgctxt "Tooltip for filtering the displayed emoji by the \"Smileys & Expressions\" category."
39
39
  msgid "Smileys & Expressions"
40
- msgstr ""
40
+ msgstr "笑臉與表情"
41
41
 
42
42
  msgctxt "Tooltip for filtering the displayed emoji by the \"Gestures & People\" category."
43
43
  msgid "Gestures & People"
44
- msgstr ""
44
+ msgstr "手勢與人物"
45
45
 
46
46
  msgctxt "Tooltip for filtering the displayed emoji by the \"Animals & Nature\" category."
47
47
  msgid "Animals & Nature"
48
- msgstr ""
48
+ msgstr "動物與自然"
49
49
 
50
50
  msgctxt "Tooltip for filtering the displayed emoji by the \"Food & Drinks\" category."
51
51
  msgid "Food & Drinks"
52
- msgstr ""
52
+ msgstr "飲食"
53
53
 
54
54
  msgctxt "Tooltip for filtering the displayed emoji by the \"Travel & Places\" category."
55
55
  msgid "Travel & Places"
56
- msgstr ""
56
+ msgstr "旅遊與景點"
57
57
 
58
58
  msgctxt "Tooltip for filtering the displayed emoji by the \"Activities\" category."
59
59
  msgid "Activities"
60
- msgstr ""
60
+ msgstr "活動"
61
61
 
62
62
  msgctxt "Tooltip for filtering the displayed emoji by the \"Objects\" category."
63
63
  msgid "Objects"
64
- msgstr ""
64
+ msgstr "物件"
65
65
 
66
66
  msgctxt "Tooltip for filtering the displayed emoji by the \"Symbols\" category."
67
67
  msgid "Symbols"
68
- msgstr ""
68
+ msgstr "符號"
69
69
 
70
70
  msgctxt "Tooltip for filtering the displayed emoji by the \"Flags\" category."
71
71
  msgid "Flags"
72
- msgstr ""
72
+ msgstr "旗幟"
73
73
 
74
74
  msgctxt "Default label for the emoji skin tone dropdown."
75
75
  msgid "Select skin tone"
76
- msgstr ""
76
+ msgstr "選取膚色"
77
77
 
78
78
  msgctxt "Dropdown option label for using the \"Default skin tone\" variant. Example emoji: 👋."
79
79
  msgid "Default skin tone"
80
- msgstr ""
80
+ msgstr "預設膚色"
81
81
 
82
82
  msgctxt "Dropdown option label for using the \"Light skin tone\" variant. Example emoji: 👋🏻."
83
83
  msgid "Light skin tone"
84
- msgstr ""
84
+ msgstr "淺調膚色"
85
85
 
86
86
  msgctxt "Dropdown option label for using the \"Medium Light skin tone\" variant. Example emoji: 👋🏼."
87
87
  msgid "Medium Light skin tone"
88
- msgstr ""
88
+ msgstr "中淺調膚色"
89
89
 
90
90
  msgctxt "Dropdown option label for using the \"Medium skin tone\" variant. Example emoji: 👋🏽."
91
91
  msgid "Medium skin tone"
92
- msgstr ""
92
+ msgstr "中調膚色"
93
93
 
94
94
  msgctxt "Dropdown option label for using the \"Medium Dark skin tone\" variant. Example emoji: 👋🏾."
95
95
  msgid "Medium Dark skin tone"
96
- msgstr ""
96
+ msgstr "中深調膚色"
97
97
 
98
98
  msgctxt "Dropdown option label for using the \"Dark skin tone\" variant. Example emoji: 👋🏿."
99
99
  msgid "Dark skin tone"
100
- msgstr ""
100
+ msgstr "深調膚色"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ckeditor/ckeditor5-emoji",
3
- "version": "44.2.0-alpha.1",
3
+ "version": "44.2.0-alpha.10",
4
4
  "description": "Emoji feature for CKEditor 5.",
5
5
  "keywords": [
6
6
  "ckeditor",
@@ -13,12 +13,12 @@
13
13
  "type": "module",
14
14
  "main": "src/index.js",
15
15
  "dependencies": {
16
- "@ckeditor/ckeditor5-core": "44.2.0-alpha.1",
17
- "@ckeditor/ckeditor5-mention": "44.2.0-alpha.1",
18
- "@ckeditor/ckeditor5-typing": "44.2.0-alpha.1",
19
- "@ckeditor/ckeditor5-ui": "44.2.0-alpha.1",
20
- "@ckeditor/ckeditor5-utils": "44.2.0-alpha.1",
21
- "ckeditor5": "44.2.0-alpha.1",
16
+ "@ckeditor/ckeditor5-core": "44.2.0-alpha.10",
17
+ "@ckeditor/ckeditor5-mention": "44.2.0-alpha.10",
18
+ "@ckeditor/ckeditor5-typing": "44.2.0-alpha.10",
19
+ "@ckeditor/ckeditor5-ui": "44.2.0-alpha.10",
20
+ "@ckeditor/ckeditor5-utils": "44.2.0-alpha.10",
21
+ "ckeditor5": "44.2.0-alpha.10",
22
22
  "fuse.js": "7.0.0",
23
23
  "lodash-es": "4.17.21"
24
24
  },
@@ -2,7 +2,7 @@
2
2
  * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
4
  */
5
- import type { Emoji, EmojiConfig, EmojiMention, EmojiPicker, EmojiRepository, EmojiCommand } from './index.js';
5
+ import type { Emoji, EmojiConfig, EmojiMention, EmojiPicker, EmojiRepository, EmojiUtils, EmojiCommand } from './index.js';
6
6
  declare module '@ckeditor/ckeditor5-core' {
7
7
  interface EditorConfig {
8
8
  /**
@@ -17,6 +17,7 @@ declare module '@ckeditor/ckeditor5-core' {
17
17
  [EmojiMention.pluginName]: EmojiMention;
18
18
  [EmojiPicker.pluginName]: EmojiPicker;
19
19
  [EmojiRepository.pluginName]: EmojiRepository;
20
+ [EmojiUtils.pluginName]: EmojiUtils;
20
21
  }
21
22
  interface CommandsMap {
22
23
  emoji: EmojiCommand;
@@ -75,6 +75,7 @@ export interface EmojiConfig {
75
75
  *
76
76
  * @default 16
77
77
  */
78
- version?: 15 | 16;
78
+ version?: EmojiVersion;
79
79
  }
80
80
  export type SkinToneId = 'default' | 'light' | 'medium-light' | 'medium' | 'medium-dark' | 'dark';
81
+ export type EmojiVersion = 15 | 16;
@@ -5,6 +5,7 @@
5
5
  import { Plugin, type Editor } from 'ckeditor5/src/core.js';
6
6
  import { Typing } from 'ckeditor5/src/typing.js';
7
7
  import EmojiRepository from './emojirepository.js';
8
+ import type EmojiPicker from './emojipicker.js';
8
9
  /**
9
10
  * The emoji mention plugin.
10
11
  *
@@ -14,11 +15,15 @@ export default class EmojiMention extends Plugin {
14
15
  /**
15
16
  * An instance of the {@link module:emoji/emojipicker~EmojiPicker} plugin if it is loaded in the editor.
16
17
  */
17
- private _emojiPickerPlugin;
18
+ emojiPickerPlugin: EmojiPicker | null;
18
19
  /**
19
20
  * An instance of the {@link module:emoji/emojirepository~EmojiRepository} plugin.
20
21
  */
21
- private _emojiRepositoryPlugin;
22
+ emojiRepositoryPlugin: EmojiRepository;
23
+ /**
24
+ * A flag that informs if the {@link module:emoji/emojirepository~EmojiRepository} plugin is loaded correctly.
25
+ */
26
+ private _isEmojiRepositoryAvailable;
22
27
  /**
23
28
  * Defines a number of displayed items in the auto complete dropdown.
24
29
  *
@@ -45,14 +50,16 @@ export default class EmojiMention extends Plugin {
45
50
  * @inheritDoc
46
51
  */
47
52
  constructor(editor: Editor);
48
- /**
49
- * @inheritDoc
50
- */
51
- init(): Promise<void>;
52
53
  /**
53
54
  * Initializes the configuration for emojis in the mention feature.
55
+ * If the marker used by emoji mention is already registered, it displays a warning.
56
+ * If emoji mention configuration is detected, it does not register it for a second time.
54
57
  */
55
58
  private _setupMentionConfiguration;
59
+ /**
60
+ * @inheritDoc
61
+ */
62
+ init(): Promise<void>;
56
63
  /**
57
64
  * Returns the `itemRenderer()` callback for mention config.
58
65
  */
@@ -46,11 +46,21 @@ export default class EmojiMention extends Plugin {
46
46
  });
47
47
  this._emojiDropdownLimit = editor.config.get('emoji.dropdownLimit');
48
48
  this._skinTone = editor.config.get('emoji.skinTone');
49
- const mentionFeedsConfigs = editor.config.get('mention.feeds');
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) {
50
57
  const mergeFieldsPrefix = editor.config.get('mergeFields.prefix');
51
- const markerAlreadyUsed = mentionFeedsConfigs.some(config => config.marker === EMOJI_MENTION_MARKER);
52
- const isMarkerUsedByMergeFields = mergeFieldsPrefix ? mergeFieldsPrefix[0] === EMOJI_MENTION_MARKER : false;
53
- if (markerAlreadyUsed || isMarkerUsedByMergeFields) {
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) {
54
64
  /**
55
65
  * The `marker` in the `emoji` config is already used by other plugin configuration.
56
66
  *
@@ -60,26 +70,12 @@ export default class EmojiMention extends Plugin {
60
70
  logWarning('emoji-config-marker-already-used', { marker: EMOJI_MENTION_MARKER });
61
71
  return;
62
72
  }
63
- this._setupMentionConfiguration(mentionFeedsConfigs);
64
- }
65
- /**
66
- * @inheritDoc
67
- */
68
- async init() {
69
- const editor = this.editor;
70
- this._emojiPickerPlugin = editor.plugins.has('EmojiPicker') ? editor.plugins.get('EmojiPicker') : null;
71
- this._emojiRepositoryPlugin = editor.plugins.get('EmojiRepository');
72
- // Skip overriding the `mention` command listener if the emoji repository is not ready.
73
- if (!await this._emojiRepositoryPlugin.isReady()) {
73
+ const isEmojiConfigDefined = mentionFeedsConfigs.some(config => config._isEmojiMarker);
74
+ if (isEmojiConfigDefined) {
74
75
  return;
75
76
  }
76
- editor.once('ready', this._overrideMentionExecuteListener.bind(this));
77
- }
78
- /**
79
- * Initializes the configuration for emojis in the mention feature.
80
- */
81
- _setupMentionConfiguration(mentionFeedsConfigs) {
82
77
  const emojiMentionFeedConfig = {
78
+ _isEmojiMarker: true,
83
79
  marker: EMOJI_MENTION_MARKER,
84
80
  dropdownLimit: this._emojiDropdownLimit,
85
81
  itemRenderer: this._customItemRendererFactory(this.editor.t),
@@ -87,6 +83,19 @@ export default class EmojiMention extends Plugin {
87
83
  };
88
84
  this.editor.config.set('mention.feeds', [...mentionFeedsConfigs, emojiMentionFeedConfig]);
89
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
+ }
90
99
  /**
91
100
  * Returns the `itemRenderer()` callback for mention config.
92
101
  */
@@ -143,7 +152,7 @@ export default class EmojiMention extends Plugin {
143
152
  editor.model.change(writer => {
144
153
  editor.model.deleteContent(writer.createSelection(eventData.range));
145
154
  });
146
- const emojiPickerPlugin = this._emojiPickerPlugin;
155
+ const emojiPickerPlugin = this.emojiPickerPlugin;
147
156
  emojiPickerPlugin.showUI(text.slice(1));
148
157
  setTimeout(() => {
149
158
  emojiPickerPlugin.emojiPickerView.focus();
@@ -167,18 +176,22 @@ export default class EmojiMention extends Plugin {
167
176
  if (searchQuery.startsWith(' ')) {
168
177
  return [];
169
178
  }
170
- const emojis = this._emojiRepositoryPlugin.getEmojiByQuery(searchQuery)
179
+ // If the repository plugin is not available, return an empty feed to avoid confusion. See: #17842.
180
+ if (!this._isEmojiRepositoryAvailable) {
181
+ return [];
182
+ }
183
+ const emojis = this.emojiRepositoryPlugin.getEmojiByQuery(searchQuery)
171
184
  .map(emoji => {
172
185
  let text = emoji.skins[this._skinTone] || emoji.skins.default;
173
- if (this._emojiPickerPlugin) {
174
- text = emoji.skins[this._emojiPickerPlugin.skinTone] || emoji.skins.default;
186
+ if (this.emojiPickerPlugin) {
187
+ text = emoji.skins[this.emojiPickerPlugin.skinTone] || emoji.skins.default;
175
188
  }
176
189
  return {
177
190
  id: `:${emoji.annotation}:`,
178
191
  text
179
192
  };
180
193
  });
181
- if (!this._emojiPickerPlugin) {
194
+ if (!this.emojiPickerPlugin) {
182
195
  return emojis.slice(0, this._emojiDropdownLimit);
183
196
  }
184
197
  const actionItem = {
@@ -25,11 +25,11 @@ export default class EmojiPicker extends Plugin {
25
25
  /**
26
26
  * The contextual balloon plugin instance.
27
27
  */
28
- _balloonPlugin: ContextualBalloon;
28
+ balloonPlugin: ContextualBalloon;
29
29
  /**
30
30
  * An instance of the {@link module:emoji/emojirepository~EmojiRepository} plugin.
31
31
  */
32
- private _emojiRepositoryPlugin;
32
+ emojiRepositoryPlugin: EmojiRepository;
33
33
  /**
34
34
  * @inheritDoc
35
35
  */
@@ -80,7 +80,7 @@ export default class EmojiPicker extends Plugin {
80
80
  */
81
81
  private _setupConversion;
82
82
  /**
83
- * Returns positioning options for the {@link #_balloonPlugin}. They control the way the balloon is attached
83
+ * Returns positioning options for the {@link #balloonPlugin}. They control the way the balloon is attached
84
84
  * to the target element or selection.
85
85
  */
86
86
  private _getBalloonPositionData;
@@ -42,10 +42,10 @@ export default class EmojiPicker extends Plugin {
42
42
  */
43
43
  async init() {
44
44
  const editor = this.editor;
45
- this._balloonPlugin = editor.plugins.get('ContextualBalloon');
46
- this._emojiRepositoryPlugin = editor.plugins.get('EmojiRepository');
45
+ this.balloonPlugin = editor.plugins.get('ContextualBalloon');
46
+ this.emojiRepositoryPlugin = editor.plugins.get('EmojiRepository');
47
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()) {
48
+ if (!await this.emojiRepositoryPlugin.isReady()) {
49
49
  return;
50
50
  }
51
51
  const command = new EmojiCommand(editor);
@@ -99,8 +99,8 @@ export default class EmojiPicker extends Plugin {
99
99
  this.emojiPickerView.searchView.setInputValue(searchValue);
100
100
  }
101
101
  this.emojiPickerView.searchView.search(searchValue);
102
- if (!this._balloonPlugin.hasView(this.emojiPickerView)) {
103
- this._balloonPlugin.add({
102
+ if (!this.balloonPlugin.hasView(this.emojiPickerView)) {
103
+ this.balloonPlugin.add({
104
104
  view: this.emojiPickerView,
105
105
  position: this._getBalloonPositionData()
106
106
  });
@@ -129,11 +129,11 @@ export default class EmojiPicker extends Plugin {
129
129
  */
130
130
  _createEmojiPickerView() {
131
131
  const emojiPickerView = new EmojiPickerView(this.editor.locale, {
132
- emojiCategories: this._emojiRepositoryPlugin.getEmojiCategories(),
132
+ emojiCategories: this.emojiRepositoryPlugin.getEmojiCategories(),
133
133
  skinTone: this.editor.config.get('emoji.skinTone'),
134
- skinTones: this._emojiRepositoryPlugin.getSkinTones(),
134
+ skinTones: this.emojiRepositoryPlugin.getSkinTones(),
135
135
  getEmojiByQuery: (query) => {
136
- return this._emojiRepositoryPlugin.getEmojiByQuery(query);
136
+ return this.emojiRepositoryPlugin.getEmojiByQuery(query);
137
137
  }
138
138
  });
139
139
  // Insert an emoji on a tile click.
@@ -145,8 +145,8 @@ export default class EmojiPicker extends Plugin {
145
145
  });
146
146
  // Update the balloon position when layout is changed.
147
147
  this.listenTo(emojiPickerView, 'update', () => {
148
- if (this._balloonPlugin.visibleView === emojiPickerView) {
149
- this._balloonPlugin.updatePosition();
148
+ if (this.balloonPlugin.visibleView === emojiPickerView) {
149
+ this.balloonPlugin.updatePosition();
150
150
  }
151
151
  });
152
152
  // Close the panel on `Esc` key press when the **actions have focus**.
@@ -157,9 +157,9 @@ export default class EmojiPicker extends Plugin {
157
157
  // Close the dialog when clicking outside of it.
158
158
  clickOutsideHandler({
159
159
  emitter: emojiPickerView,
160
- contextElements: [this._balloonPlugin.view.element],
160
+ contextElements: [this.balloonPlugin.view.element],
161
161
  callback: () => this._hideUI(),
162
- activator: () => this._balloonPlugin.visibleView === emojiPickerView
162
+ activator: () => this.balloonPlugin.visibleView === emojiPickerView
163
163
  });
164
164
  return emojiPickerView;
165
165
  }
@@ -167,7 +167,7 @@ export default class EmojiPicker extends Plugin {
167
167
  * Hides the balloon with the emoji picker.
168
168
  */
169
169
  _hideUI() {
170
- this._balloonPlugin.remove(this.emojiPickerView);
170
+ this.balloonPlugin.remove(this.emojiPickerView);
171
171
  this.emojiPickerView.searchView.setInputValue('');
172
172
  this.editor.editing.view.focus();
173
173
  this._hideFakeVisualSelection();
@@ -198,7 +198,7 @@ export default class EmojiPicker extends Plugin {
198
198
  });
199
199
  }
200
200
  /**
201
- * Returns positioning options for the {@link #_balloonPlugin}. They control the way the balloon is attached
201
+ * Returns positioning options for the {@link #balloonPlugin}. They control the way the balloon is attached
202
202
  * to the target element or selection.
203
203
  */
204
204
  _getBalloonPositionData() {
@@ -2,31 +2,36 @@
2
2
  * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
4
  */
5
- import { Plugin, type Editor } from 'ckeditor5/src/core.js';
5
+ import { type Editor, Plugin } from 'ckeditor5/src/core.js';
6
+ import EmojiUtils from './emojiutils.js';
6
7
  import type { SkinToneId } from './emojiconfig.js';
7
8
  /**
8
9
  * The emoji repository plugin.
9
10
  *
10
- * Loads the emoji database from URL during plugin initialization and provides utility methods to search it.
11
+ * Loads the emoji repository from URL during plugin initialization and provides utility methods to search it.
11
12
  */
12
13
  export default class EmojiRepository extends Plugin {
13
14
  /**
14
- * Emoji database.
15
+ * A callback to resolve the {@link #_repositoryPromise} to control the return value of this promise.
15
16
  */
16
- private _database;
17
+ private _repositoryPromiseResolveCallback;
17
18
  /**
18
- * A promise resolved after downloading the emoji database.
19
- * The promise resolves with `true` when the database is successfully downloaded or `false` otherwise.
19
+ * An instance of the [Fuse.js](https://www.fusejs.io/) library.
20
20
  */
21
- private _databasePromise;
21
+ private _fuseSearch;
22
22
  /**
23
- * A callback to resolve the {@link #_databasePromise} to control the return value of this promise.
23
+ * The emoji version that is used to prepare the emoji repository.
24
24
  */
25
- private _databasePromiseResolveCallback;
25
+ private readonly _version;
26
26
  /**
27
- * An instance of the [Fuse.js](https://www.fusejs.io/) library.
27
+ * A promise resolved after downloading the emoji collection.
28
+ * The promise resolves with `true` when the repository is successfully downloaded or `false` otherwise.
28
29
  */
29
- private _fuseSearch;
30
+ private readonly _repositoryPromise;
31
+ /**
32
+ * @inheritDoc
33
+ */
34
+ static get requires(): readonly [typeof EmojiUtils];
30
35
  /**
31
36
  * @inheritDoc
32
37
  */
@@ -45,7 +50,7 @@ export default class EmojiRepository extends Plugin {
45
50
  init(): Promise<void>;
46
51
  /**
47
52
  * Returns an array of emoji entries that match the search query.
48
- * If the emoji database is not loaded, the [Fuse.js](https://www.fusejs.io/) instance is not created,
53
+ * If the emoji repository is not loaded, the [Fuse.js](https://www.fusejs.io/) instance is not created,
49
54
  * hence this method returns an empty array.
50
55
  *
51
56
  * @param searchQuery A search query to match emoji.
@@ -54,7 +59,7 @@ export default class EmojiRepository extends Plugin {
54
59
  getEmojiByQuery(searchQuery: string): Array<EmojiEntry>;
55
60
  /**
56
61
  * Groups all emojis by categories.
57
- * If the emoji database is not loaded, it returns an empty array.
62
+ * If the emoji repository is not loaded, it returns an empty array.
58
63
  *
59
64
  * @returns An array of emoji entries grouped by categories.
60
65
  */
@@ -64,15 +69,28 @@ export default class EmojiRepository extends Plugin {
64
69
  */
65
70
  getSkinTones(): Array<SkinTone>;
66
71
  /**
67
- * Indicates whether the emoji database has been successfully downloaded and the plugin is operational.
72
+ * Indicates whether the emoji repository has been successfully downloaded and the plugin is operational.
68
73
  */
69
74
  isReady(): Promise<boolean>;
70
75
  /**
71
- * A function used to check if the given emoji is supported in the operating system.
76
+ * Returns the emoji repository in a configured version if it is a non-empty array. Returns `null` otherwise.
77
+ */
78
+ private _getItems;
79
+ /**
80
+ * Makes the HTTP request to download the emoji repository in a configured version.
81
+ */
82
+ private _loadItemsFromCdn;
83
+ /**
84
+ * Normalizes the raw data fetched from CDN. By normalization, we meant:
72
85
  *
73
- * Referenced for unit testing purposes.
86
+ * * Filter out unsupported emoji (these that will not render correctly),
87
+ * * Prepare skin tone variants if an emoji defines them.
88
+ */
89
+ private _normalizeEmoji;
90
+ /**
91
+ * Versioned emoji repository.
74
92
  */
75
- private static _isEmojiSupported;
93
+ private static _results;
76
94
  }
77
95
  /**
78
96
  * Represents a single group of the emoji category, e.g., "Smileys & Expressions".