@ckeditor/ckeditor5-emoji 44.2.0-alpha.1 → 44.2.0-alpha.11
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.
- package/LICENSE.md +1 -0
- package/build/emoji.js +1 -1
- package/build/translations/ar.js +1 -1
- package/build/translations/bg.js +1 -1
- package/build/translations/bn.js +1 -1
- package/build/translations/ca.js +1 -1
- package/build/translations/cs.js +1 -1
- package/build/translations/da.js +1 -1
- package/build/translations/de.js +1 -1
- package/build/translations/el.js +1 -1
- package/build/translations/es.js +1 -1
- package/build/translations/et.js +1 -1
- package/build/translations/fi.js +1 -1
- package/build/translations/fr.js +1 -1
- package/build/translations/he.js +1 -1
- package/build/translations/hi.js +1 -1
- package/build/translations/hu.js +1 -1
- package/build/translations/id.js +1 -1
- package/build/translations/it.js +1 -1
- package/build/translations/ja.js +1 -1
- package/build/translations/ko.js +1 -1
- package/build/translations/lt.js +1 -1
- package/build/translations/lv.js +1 -1
- package/build/translations/ms.js +1 -1
- package/build/translations/nl.js +1 -1
- package/build/translations/no.js +1 -1
- package/build/translations/pl.js +1 -1
- package/build/translations/pt-br.js +1 -1
- package/build/translations/pt.js +1 -1
- package/build/translations/ro.js +1 -1
- package/build/translations/ru.js +1 -1
- package/build/translations/sk.js +1 -1
- package/build/translations/sr.js +1 -1
- package/build/translations/sv.js +1 -1
- package/build/translations/th.js +1 -1
- package/build/translations/tr.js +1 -1
- package/build/translations/uk.js +1 -1
- package/build/translations/vi.js +1 -1
- package/build/translations/zh-cn.js +1 -1
- package/build/translations/zh.js +1 -1
- package/ckeditor5-metadata.json +15 -2
- package/dist/index-editor.css +1 -1
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/dist/index.js +316 -154
- package/dist/index.js.map +1 -1
- package/dist/translations/ar.js +1 -1
- package/dist/translations/ar.umd.js +1 -1
- package/dist/translations/bg.js +1 -1
- package/dist/translations/bg.umd.js +1 -1
- package/dist/translations/bn.js +1 -1
- package/dist/translations/bn.umd.js +1 -1
- package/dist/translations/ca.js +1 -1
- package/dist/translations/ca.umd.js +1 -1
- package/dist/translations/cs.js +1 -1
- package/dist/translations/cs.umd.js +1 -1
- package/dist/translations/da.js +1 -1
- package/dist/translations/da.umd.js +1 -1
- package/dist/translations/de.js +1 -1
- package/dist/translations/de.umd.js +1 -1
- package/dist/translations/el.js +1 -1
- package/dist/translations/el.umd.js +1 -1
- package/dist/translations/es.js +1 -1
- package/dist/translations/es.umd.js +1 -1
- package/dist/translations/et.js +1 -1
- package/dist/translations/et.umd.js +1 -1
- package/dist/translations/fi.js +1 -1
- package/dist/translations/fi.umd.js +1 -1
- package/dist/translations/fr.js +1 -1
- package/dist/translations/fr.umd.js +1 -1
- package/dist/translations/he.js +1 -1
- package/dist/translations/he.umd.js +1 -1
- package/dist/translations/hi.js +1 -1
- package/dist/translations/hi.umd.js +1 -1
- package/dist/translations/hu.js +1 -1
- package/dist/translations/hu.umd.js +1 -1
- package/dist/translations/id.js +1 -1
- package/dist/translations/id.umd.js +1 -1
- package/dist/translations/it.js +1 -1
- package/dist/translations/it.umd.js +1 -1
- package/dist/translations/ja.js +1 -1
- package/dist/translations/ja.umd.js +1 -1
- package/dist/translations/ko.js +1 -1
- package/dist/translations/ko.umd.js +1 -1
- package/dist/translations/lt.js +1 -1
- package/dist/translations/lt.umd.js +1 -1
- package/dist/translations/lv.js +1 -1
- package/dist/translations/lv.umd.js +1 -1
- package/dist/translations/ms.js +1 -1
- package/dist/translations/ms.umd.js +1 -1
- package/dist/translations/nl.js +1 -1
- package/dist/translations/nl.umd.js +1 -1
- package/dist/translations/no.js +1 -1
- package/dist/translations/no.umd.js +1 -1
- package/dist/translations/pl.js +1 -1
- package/dist/translations/pl.umd.js +1 -1
- package/dist/translations/pt-br.js +1 -1
- package/dist/translations/pt-br.umd.js +1 -1
- package/dist/translations/pt.js +1 -1
- package/dist/translations/pt.umd.js +1 -1
- package/dist/translations/ro.js +1 -1
- package/dist/translations/ro.umd.js +1 -1
- package/dist/translations/ru.js +1 -1
- package/dist/translations/ru.umd.js +1 -1
- package/dist/translations/sk.js +1 -1
- package/dist/translations/sk.umd.js +1 -1
- package/dist/translations/sr.js +1 -1
- package/dist/translations/sr.umd.js +1 -1
- package/dist/translations/sv.js +1 -1
- package/dist/translations/sv.umd.js +1 -1
- package/dist/translations/th.js +1 -1
- package/dist/translations/th.umd.js +1 -1
- package/dist/translations/tr.js +1 -1
- package/dist/translations/tr.umd.js +1 -1
- package/dist/translations/uk.js +1 -1
- package/dist/translations/uk.umd.js +1 -1
- package/dist/translations/vi.js +1 -1
- package/dist/translations/vi.umd.js +1 -1
- package/dist/translations/zh-cn.js +1 -1
- package/dist/translations/zh-cn.umd.js +1 -1
- package/dist/translations/zh.js +1 -1
- package/dist/translations/zh.umd.js +1 -1
- package/lang/translations/ar.po +22 -22
- package/lang/translations/bg.po +22 -22
- package/lang/translations/bn.po +22 -22
- package/lang/translations/ca.po +22 -22
- package/lang/translations/cs.po +22 -22
- package/lang/translations/da.po +22 -22
- package/lang/translations/de.po +22 -22
- package/lang/translations/el.po +22 -22
- package/lang/translations/es.po +22 -22
- package/lang/translations/et.po +22 -22
- package/lang/translations/fi.po +22 -22
- package/lang/translations/fr.po +22 -22
- package/lang/translations/he.po +22 -22
- package/lang/translations/hi.po +22 -22
- package/lang/translations/hu.po +22 -22
- package/lang/translations/id.po +22 -22
- package/lang/translations/it.po +22 -22
- package/lang/translations/ja.po +22 -22
- package/lang/translations/ko.po +22 -22
- package/lang/translations/lt.po +22 -22
- package/lang/translations/lv.po +22 -22
- package/lang/translations/ms.po +22 -22
- package/lang/translations/nl.po +22 -22
- package/lang/translations/no.po +22 -22
- package/lang/translations/pl.po +22 -22
- package/lang/translations/pt-br.po +22 -22
- package/lang/translations/pt.po +22 -22
- package/lang/translations/ro.po +22 -22
- package/lang/translations/ru.po +22 -22
- package/lang/translations/sk.po +22 -22
- package/lang/translations/sr.po +22 -22
- package/lang/translations/sv.po +22 -22
- package/lang/translations/th.po +22 -22
- package/lang/translations/tr.po +22 -22
- package/lang/translations/uk.po +22 -22
- package/lang/translations/vi.po +22 -22
- package/lang/translations/zh-cn.po +22 -22
- package/lang/translations/zh.po +22 -22
- package/package.json +7 -7
- package/src/augmentation.d.ts +2 -1
- package/src/emojiconfig.d.ts +2 -1
- package/src/emojimention.d.ts +13 -6
- package/src/emojimention.js +43 -26
- package/src/emojipicker.d.ts +3 -3
- package/src/emojipicker.js +14 -14
- package/src/emojirepository.d.ts +35 -17
- package/src/emojirepository.js +86 -126
- package/src/emojiutils.d.ts +58 -0
- package/src/emojiutils.js +141 -0
- package/src/index.d.ts +1 -0
- package/src/index.js +1 -0
- package/src/ui/emojipickerview.js +1 -0
- package/src/utils/isemojisupported.d.ts +11 -0
- package/src/utils/isemojisupported.js +68 -0
- package/theme/emojigrid.css +1 -1
package/lang/translations/zh.po
CHANGED
|
@@ -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.
|
|
3
|
+
"version": "44.2.0-alpha.11",
|
|
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.
|
|
17
|
-
"@ckeditor/ckeditor5-mention": "44.2.0-alpha.
|
|
18
|
-
"@ckeditor/ckeditor5-typing": "44.2.0-alpha.
|
|
19
|
-
"@ckeditor/ckeditor5-ui": "44.2.0-alpha.
|
|
20
|
-
"@ckeditor/ckeditor5-utils": "44.2.0-alpha.
|
|
21
|
-
"ckeditor5": "44.2.0-alpha.
|
|
16
|
+
"@ckeditor/ckeditor5-core": "44.2.0-alpha.11",
|
|
17
|
+
"@ckeditor/ckeditor5-mention": "44.2.0-alpha.11",
|
|
18
|
+
"@ckeditor/ckeditor5-typing": "44.2.0-alpha.11",
|
|
19
|
+
"@ckeditor/ckeditor5-ui": "44.2.0-alpha.11",
|
|
20
|
+
"@ckeditor/ckeditor5-utils": "44.2.0-alpha.11",
|
|
21
|
+
"ckeditor5": "44.2.0-alpha.11",
|
|
22
22
|
"fuse.js": "7.0.0",
|
|
23
23
|
"lodash-es": "4.17.21"
|
|
24
24
|
},
|
package/src/augmentation.d.ts
CHANGED
|
@@ -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;
|
package/src/emojiconfig.d.ts
CHANGED
package/src/emojimention.d.ts
CHANGED
|
@@ -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
|
-
|
|
18
|
+
emojiPickerPlugin: EmojiPicker | null;
|
|
18
19
|
/**
|
|
19
20
|
* An instance of the {@link module:emoji/emojirepository~EmojiRepository} plugin.
|
|
20
21
|
*/
|
|
21
|
-
|
|
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
|
*/
|
package/src/emojimention.js
CHANGED
|
@@ -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
|
-
|
|
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
|
|
52
|
-
const
|
|
53
|
-
|
|
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
|
-
|
|
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.
|
|
155
|
+
const emojiPickerPlugin = this.emojiPickerPlugin;
|
|
147
156
|
emojiPickerPlugin.showUI(text.slice(1));
|
|
148
157
|
setTimeout(() => {
|
|
149
158
|
emojiPickerPlugin.emojiPickerView.focus();
|
|
@@ -167,18 +176,26 @@ export default class EmojiMention extends Plugin {
|
|
|
167
176
|
if (searchQuery.startsWith(' ')) {
|
|
168
177
|
return [];
|
|
169
178
|
}
|
|
170
|
-
|
|
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)
|
|
171
188
|
.map(emoji => {
|
|
172
189
|
let text = emoji.skins[this._skinTone] || emoji.skins.default;
|
|
173
|
-
if (this.
|
|
174
|
-
text = emoji.skins[this.
|
|
190
|
+
if (this.emojiPickerPlugin) {
|
|
191
|
+
text = emoji.skins[this.emojiPickerPlugin.skinTone] || emoji.skins.default;
|
|
175
192
|
}
|
|
176
193
|
return {
|
|
177
194
|
id: `:${emoji.annotation}:`,
|
|
178
195
|
text
|
|
179
196
|
};
|
|
180
197
|
});
|
|
181
|
-
if (!this.
|
|
198
|
+
if (!this.emojiPickerPlugin) {
|
|
182
199
|
return emojis.slice(0, this._emojiDropdownLimit);
|
|
183
200
|
}
|
|
184
201
|
const actionItem = {
|
package/src/emojipicker.d.ts
CHANGED
|
@@ -25,11 +25,11 @@ export default class EmojiPicker extends Plugin {
|
|
|
25
25
|
/**
|
|
26
26
|
* The contextual balloon plugin instance.
|
|
27
27
|
*/
|
|
28
|
-
|
|
28
|
+
balloonPlugin: ContextualBalloon;
|
|
29
29
|
/**
|
|
30
30
|
* An instance of the {@link module:emoji/emojirepository~EmojiRepository} plugin.
|
|
31
31
|
*/
|
|
32
|
-
|
|
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 #
|
|
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;
|
package/src/emojipicker.js
CHANGED
|
@@ -42,10 +42,10 @@ export default class EmojiPicker extends Plugin {
|
|
|
42
42
|
*/
|
|
43
43
|
async init() {
|
|
44
44
|
const editor = this.editor;
|
|
45
|
-
this.
|
|
46
|
-
this.
|
|
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.
|
|
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.
|
|
103
|
-
this.
|
|
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.
|
|
132
|
+
emojiCategories: this.emojiRepositoryPlugin.getEmojiCategories(),
|
|
133
133
|
skinTone: this.editor.config.get('emoji.skinTone'),
|
|
134
|
-
skinTones: this.
|
|
134
|
+
skinTones: this.emojiRepositoryPlugin.getSkinTones(),
|
|
135
135
|
getEmojiByQuery: (query) => {
|
|
136
|
-
return this.
|
|
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.
|
|
149
|
-
this.
|
|
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.
|
|
160
|
+
contextElements: [this.balloonPlugin.view.element],
|
|
161
161
|
callback: () => this._hideUI(),
|
|
162
|
-
activator: () => this.
|
|
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.
|
|
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 #
|
|
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() {
|
package/src/emojirepository.d.ts
CHANGED
|
@@ -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 {
|
|
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
|
|
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
|
-
*
|
|
15
|
+
* A callback to resolve the {@link #_repositoryPromise} to control the return value of this promise.
|
|
15
16
|
*/
|
|
16
|
-
private
|
|
17
|
+
private _repositoryPromiseResolveCallback;
|
|
17
18
|
/**
|
|
18
|
-
*
|
|
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
|
|
21
|
+
private _fuseSearch;
|
|
22
22
|
/**
|
|
23
|
-
*
|
|
23
|
+
* The emoji version that is used to prepare the emoji repository.
|
|
24
24
|
*/
|
|
25
|
-
private
|
|
25
|
+
private readonly _version;
|
|
26
26
|
/**
|
|
27
|
-
*
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
-
*
|
|
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
|
-
*
|
|
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
|
|
93
|
+
private static _results;
|
|
76
94
|
}
|
|
77
95
|
/**
|
|
78
96
|
* Represents a single group of the emoji category, e.g., "Smileys & Expressions".
|