@ckeditor/ckeditor5-emoji 0.0.0-nightly-next-20250222.0 → 0.0.0-nightly-20250223.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +3 -3
- package/build/emoji.js +1 -1
- package/ckeditor5-metadata.json +2 -2
- package/dist/index.js +26 -51
- package/dist/index.js.map +1 -1
- package/package.json +14 -10
- package/src/emojimention.js +0 -10
- package/src/emojipicker.js +2 -3
- package/src/emojirepository.d.ts +3 -4
- package/src/emojirepository.js +28 -51
- package/src/emojiutils.js +6 -6
- package/src/ui/emojicategoriesview.js +0 -16
- package/src/ui/emojigridview.js +0 -26
- package/src/ui/emojipickerview.js +0 -36
- package/src/ui/emojisearchview.js +1 -9
- package/src/ui/emojitoneview.js +0 -8
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ckeditor/ckeditor5-emoji",
|
|
3
|
-
"version": "0.0.0-nightly-
|
|
3
|
+
"version": "0.0.0-nightly-20250223.0",
|
|
4
4
|
"description": "Emoji feature for CKEditor 5.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ckeditor",
|
|
@@ -13,15 +13,14 @@
|
|
|
13
13
|
"type": "module",
|
|
14
14
|
"main": "src/index.js",
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@ckeditor/ckeditor5-core": "0.0.0-nightly-
|
|
17
|
-
"@ckeditor/ckeditor5-
|
|
18
|
-
"@ckeditor/ckeditor5-
|
|
19
|
-
"@ckeditor/ckeditor5-
|
|
20
|
-
"@ckeditor/ckeditor5-
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
"es-toolkit": "1.32.0"
|
|
16
|
+
"@ckeditor/ckeditor5-core": "0.0.0-nightly-20250223.0",
|
|
17
|
+
"@ckeditor/ckeditor5-mention": "0.0.0-nightly-20250223.0",
|
|
18
|
+
"@ckeditor/ckeditor5-typing": "0.0.0-nightly-20250223.0",
|
|
19
|
+
"@ckeditor/ckeditor5-ui": "0.0.0-nightly-20250223.0",
|
|
20
|
+
"@ckeditor/ckeditor5-utils": "0.0.0-nightly-20250223.0",
|
|
21
|
+
"ckeditor5": "0.0.0-nightly-20250223.0",
|
|
22
|
+
"fuzzysort": "3.1.0",
|
|
23
|
+
"lodash-es": "4.17.21"
|
|
25
24
|
},
|
|
26
25
|
"author": "CKSource (http://cksource.com/)",
|
|
27
26
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
@@ -42,6 +41,11 @@
|
|
|
42
41
|
"ckeditor5-metadata.json",
|
|
43
42
|
"CHANGELOG.md"
|
|
44
43
|
],
|
|
44
|
+
"sideEffects": [
|
|
45
|
+
"*.css",
|
|
46
|
+
"build/**/*.js",
|
|
47
|
+
"dist/translations/*.umd.js"
|
|
48
|
+
],
|
|
45
49
|
"types": "src/index.d.ts",
|
|
46
50
|
"exports": {
|
|
47
51
|
".": {
|
package/src/emojimention.js
CHANGED
|
@@ -18,16 +18,6 @@ const EMOJI_HINT_OPTION_ID = ':__EMOJI_HINT:';
|
|
|
18
18
|
* Introduces the autocomplete of emojis while typing.
|
|
19
19
|
*/
|
|
20
20
|
export default class EmojiMention extends Plugin {
|
|
21
|
-
/**
|
|
22
|
-
* Defines a number of displayed items in the auto complete dropdown.
|
|
23
|
-
*
|
|
24
|
-
* It includes the "Show all emoji..." option if the `EmojiPicker` plugin is loaded.
|
|
25
|
-
*/
|
|
26
|
-
_emojiDropdownLimit;
|
|
27
|
-
/**
|
|
28
|
-
* Defines a skin tone that is set in the emoji config.
|
|
29
|
-
*/
|
|
30
|
-
_skinTone;
|
|
31
21
|
/**
|
|
32
22
|
* @inheritDoc
|
|
33
23
|
*/
|
package/src/emojipicker.js
CHANGED
|
@@ -6,9 +6,8 @@
|
|
|
6
6
|
* @module emoji/emojipicker
|
|
7
7
|
*/
|
|
8
8
|
import { ButtonView, clickOutsideHandler, ContextualBalloon, Dialog, MenuBarMenuListItemButtonView } from 'ckeditor5/src/ui.js';
|
|
9
|
-
import { Plugin } from 'ckeditor5/src/core.js';
|
|
9
|
+
import { icons, Plugin } from 'ckeditor5/src/core.js';
|
|
10
10
|
import { Typing } from 'ckeditor5/src/typing.js';
|
|
11
|
-
import { IconEmoji } from 'ckeditor5/src/icons.js';
|
|
12
11
|
import EmojiCommand from './emojicommand.js';
|
|
13
12
|
import EmojiRepository from './emojirepository.js';
|
|
14
13
|
import EmojiPickerView from './ui/emojipickerview.js';
|
|
@@ -117,7 +116,7 @@ export default class EmojiPicker extends Plugin {
|
|
|
117
116
|
buttonView.bind('isEnabled').to(command, 'isEnabled');
|
|
118
117
|
buttonView.set({
|
|
119
118
|
label: t('Emoji'),
|
|
120
|
-
icon:
|
|
119
|
+
icon: icons.emoji,
|
|
121
120
|
isToggleable: true
|
|
122
121
|
});
|
|
123
122
|
buttonView.on('execute', () => {
|
package/src/emojirepository.d.ts
CHANGED
|
@@ -16,9 +16,9 @@ export default class EmojiRepository extends Plugin {
|
|
|
16
16
|
*/
|
|
17
17
|
private _repositoryPromiseResolveCallback;
|
|
18
18
|
/**
|
|
19
|
-
*
|
|
19
|
+
* Emoji repository in a configured version.
|
|
20
20
|
*/
|
|
21
|
-
private
|
|
21
|
+
private _items;
|
|
22
22
|
/**
|
|
23
23
|
* The resolved URL from which the emoji repository is downloaded.
|
|
24
24
|
*/
|
|
@@ -50,8 +50,7 @@ export default class EmojiRepository extends Plugin {
|
|
|
50
50
|
init(): Promise<void>;
|
|
51
51
|
/**
|
|
52
52
|
* Returns an array of emoji entries that match the search query.
|
|
53
|
-
* If the emoji repository is not loaded
|
|
54
|
-
* hence this method returns an empty array.
|
|
53
|
+
* If the emoji repository is not loaded this method returns an empty array.
|
|
55
54
|
*
|
|
56
55
|
* @param searchQuery A search query to match emoji.
|
|
57
56
|
* @returns An array of emoji entries that match the search query.
|
package/src/emojirepository.js
CHANGED
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module emoji/emojirepository
|
|
7
7
|
*/
|
|
8
|
-
import
|
|
9
|
-
import { groupBy } from 'es
|
|
8
|
+
import fuzzysort from 'fuzzysort';
|
|
9
|
+
import { groupBy } from 'lodash-es';
|
|
10
10
|
import { Plugin } from 'ckeditor5/src/core.js';
|
|
11
11
|
import { logWarning, version as editorVersion } from 'ckeditor5/src/utils.js';
|
|
12
12
|
import EmojiUtils from './emojiutils.js';
|
|
@@ -20,19 +20,6 @@ const DEFAULT_EMOJI_VERSION = 16;
|
|
|
20
20
|
* Loads the emoji repository from URL during plugin initialization and provides utility methods to search it.
|
|
21
21
|
*/
|
|
22
22
|
class EmojiRepository extends Plugin {
|
|
23
|
-
/**
|
|
24
|
-
* An instance of the [Fuse.js](https://www.fusejs.io/) library.
|
|
25
|
-
*/
|
|
26
|
-
_fuseSearch;
|
|
27
|
-
/**
|
|
28
|
-
* The resolved URL from which the emoji repository is downloaded.
|
|
29
|
-
*/
|
|
30
|
-
_url;
|
|
31
|
-
/**
|
|
32
|
-
* A promise resolved after downloading the emoji collection.
|
|
33
|
-
* The promise resolves with `true` when the repository is successfully downloaded or `false` otherwise.
|
|
34
|
-
*/
|
|
35
|
-
_repositoryPromise;
|
|
36
23
|
/**
|
|
37
24
|
* @inheritDoc
|
|
38
25
|
*/
|
|
@@ -65,7 +52,7 @@ class EmojiRepository extends Plugin {
|
|
|
65
52
|
this._repositoryPromise = new Promise(resolve => {
|
|
66
53
|
this._repositoryPromiseResolveCallback = resolve;
|
|
67
54
|
});
|
|
68
|
-
this.
|
|
55
|
+
this._items = null;
|
|
69
56
|
}
|
|
70
57
|
/**
|
|
71
58
|
* @inheritDoc
|
|
@@ -73,35 +60,21 @@ class EmojiRepository extends Plugin {
|
|
|
73
60
|
async init() {
|
|
74
61
|
this._warnAboutCdnUse();
|
|
75
62
|
await this._loadAndCacheEmoji();
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
// The initialization of other dependent plugins, such as `EmojiMention` and `EmojiPicker`, is prevented as well.
|
|
79
|
-
if (!items) {
|
|
63
|
+
this._items = this._getItems();
|
|
64
|
+
if (!this._items) {
|
|
80
65
|
return this._repositoryPromiseResolveCallback(false);
|
|
81
66
|
}
|
|
82
|
-
// Create instance of the Fuse.js library with configured weighted search keys and disabled fuzzy search.
|
|
83
|
-
this._fuseSearch = new Fuse(items, {
|
|
84
|
-
keys: [
|
|
85
|
-
{ name: 'emoticon', weight: 5 },
|
|
86
|
-
{ name: 'annotation', weight: 3 },
|
|
87
|
-
{ name: 'tags', weight: 1 }
|
|
88
|
-
],
|
|
89
|
-
minMatchCharLength: 2,
|
|
90
|
-
threshold: 0,
|
|
91
|
-
ignoreLocation: true
|
|
92
|
-
});
|
|
93
67
|
return this._repositoryPromiseResolveCallback(true);
|
|
94
68
|
}
|
|
95
69
|
/**
|
|
96
70
|
* Returns an array of emoji entries that match the search query.
|
|
97
|
-
* If the emoji repository is not loaded
|
|
98
|
-
* hence this method returns an empty array.
|
|
71
|
+
* If the emoji repository is not loaded this method returns an empty array.
|
|
99
72
|
*
|
|
100
73
|
* @param searchQuery A search query to match emoji.
|
|
101
74
|
* @returns An array of emoji entries that match the search query.
|
|
102
75
|
*/
|
|
103
76
|
getEmojiByQuery(searchQuery) {
|
|
104
|
-
if (!this.
|
|
77
|
+
if (!this._items) {
|
|
105
78
|
return [];
|
|
106
79
|
}
|
|
107
80
|
const searchQueryTokens = searchQuery.split(/\s/).filter(Boolean);
|
|
@@ -110,21 +83,25 @@ class EmojiRepository extends Plugin {
|
|
|
110
83
|
if (!shouldSearch) {
|
|
111
84
|
return [];
|
|
112
85
|
}
|
|
113
|
-
return
|
|
114
|
-
.
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
{
|
|
120
|
-
'
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
86
|
+
return fuzzysort
|
|
87
|
+
.go(searchQuery, this._items, {
|
|
88
|
+
threshold: 0.6,
|
|
89
|
+
keys: [
|
|
90
|
+
'emoticon',
|
|
91
|
+
'annotation',
|
|
92
|
+
(emojiEntry) => {
|
|
93
|
+
// Instead of searching over all tags, let's use only those that matches the query.
|
|
94
|
+
// It enables searching in tags with the space character in names.
|
|
95
|
+
const searchQueryTokens = searchQuery.split(/\s/).filter(Boolean);
|
|
96
|
+
const matchedTags = searchQueryTokens.flatMap(tok => {
|
|
97
|
+
var _a;
|
|
98
|
+
return (_a = emojiEntry.tags) === null || _a === void 0 ? void 0 : _a.filter(t => t.startsWith(tok));
|
|
99
|
+
});
|
|
100
|
+
return matchedTags.join();
|
|
124
101
|
}
|
|
125
102
|
]
|
|
126
103
|
})
|
|
127
|
-
.map(result => result.
|
|
104
|
+
.map(result => result.obj);
|
|
128
105
|
}
|
|
129
106
|
/**
|
|
130
107
|
* Groups all emojis by categories.
|
|
@@ -149,7 +126,7 @@ class EmojiRepository extends Plugin {
|
|
|
149
126
|
{ title: t('Symbols'), icon: '🟢', groupId: 8 },
|
|
150
127
|
{ title: t('Flags'), icon: '🏁', groupId: 9 }
|
|
151
128
|
];
|
|
152
|
-
const groups = groupBy(repository,
|
|
129
|
+
const groups = groupBy(repository, 'group');
|
|
153
130
|
return categories.map(category => {
|
|
154
131
|
return {
|
|
155
132
|
...category,
|
|
@@ -295,9 +272,9 @@ class EmojiRepository extends Plugin {
|
|
|
295
272
|
container.remove();
|
|
296
273
|
return results;
|
|
297
274
|
}
|
|
298
|
-
/**
|
|
299
|
-
* Versioned emoji repository.
|
|
300
|
-
*/
|
|
301
|
-
static _results = {};
|
|
302
275
|
}
|
|
276
|
+
/**
|
|
277
|
+
* Versioned emoji repository.
|
|
278
|
+
*/
|
|
279
|
+
EmojiRepository._results = {};
|
|
303
280
|
export default EmojiRepository;
|
package/src/emojiutils.js
CHANGED
|
@@ -131,11 +131,11 @@ class EmojiUtils extends Plugin {
|
|
|
131
131
|
// Category group=2 contains skin tones only, which we do not want to render.
|
|
132
132
|
return item.group !== 2;
|
|
133
133
|
}
|
|
134
|
-
/**
|
|
135
|
-
* A function used to determine if emoji is supported by detecting pixels.
|
|
136
|
-
*
|
|
137
|
-
* Referenced for unit testing purposes. Kept in a separate file because of licensing.
|
|
138
|
-
*/
|
|
139
|
-
static _isEmojiSupported = isEmojiSupported;
|
|
140
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
141
|
export default EmojiUtils;
|
|
@@ -13,22 +13,6 @@ import '../../theme/emojicategories.css';
|
|
|
13
13
|
* It is responsible allowing the user to select a particular emoji category.
|
|
14
14
|
*/
|
|
15
15
|
export default class EmojiCategoriesView extends View {
|
|
16
|
-
/**
|
|
17
|
-
* Tracks information about the DOM focus in the grid.
|
|
18
|
-
*/
|
|
19
|
-
focusTracker;
|
|
20
|
-
/**
|
|
21
|
-
* An instance of the {@link module:utils/keystrokehandler~KeystrokeHandler}.
|
|
22
|
-
*/
|
|
23
|
-
keystrokes;
|
|
24
|
-
/**
|
|
25
|
-
* Helps cycling over focusable children in the input view.
|
|
26
|
-
*/
|
|
27
|
-
focusCycler;
|
|
28
|
-
/**
|
|
29
|
-
* A collection of the categories buttons.
|
|
30
|
-
*/
|
|
31
|
-
buttonViews;
|
|
32
16
|
/**
|
|
33
17
|
* @inheritDoc
|
|
34
18
|
*/
|
package/src/ui/emojigridview.js
CHANGED
|
@@ -12,32 +12,6 @@ import '../../theme/emojigrid.css';
|
|
|
12
12
|
* A grid of emoji tiles. It allows browsing emojis and selecting them to be inserted into the content.
|
|
13
13
|
*/
|
|
14
14
|
export default class EmojiGridView extends View {
|
|
15
|
-
/**
|
|
16
|
-
* A collection of the child tile views. Each tile represents a particular emoji.
|
|
17
|
-
*/
|
|
18
|
-
tiles;
|
|
19
|
-
/**
|
|
20
|
-
* Tracks information about the DOM focus in the grid.
|
|
21
|
-
*/
|
|
22
|
-
focusTracker;
|
|
23
|
-
/**
|
|
24
|
-
* An instance of the {@link module:utils/keystrokehandler~KeystrokeHandler}.
|
|
25
|
-
*/
|
|
26
|
-
keystrokes;
|
|
27
|
-
/**
|
|
28
|
-
* An array containing all emojis grouped by their categories.
|
|
29
|
-
*/
|
|
30
|
-
emojiCategories;
|
|
31
|
-
/**
|
|
32
|
-
* A collection of all already created tile views. Each tile represents a particular emoji.
|
|
33
|
-
* The cached tiles collection is used for efficiency purposes to avoid re-creating a particular
|
|
34
|
-
* tile again when the grid view has changed.
|
|
35
|
-
*/
|
|
36
|
-
cachedTiles;
|
|
37
|
-
/**
|
|
38
|
-
* A callback used to filter grid items by a specified query.
|
|
39
|
-
*/
|
|
40
|
-
_getEmojiByQuery;
|
|
41
15
|
/**
|
|
42
16
|
* @inheritDoc
|
|
43
17
|
*/
|
|
@@ -15,42 +15,6 @@ import EmojiToneView from './emojitoneview.js';
|
|
|
15
15
|
* A view that glues pieces of the emoji panel together.
|
|
16
16
|
*/
|
|
17
17
|
export default class EmojiPickerView extends View {
|
|
18
|
-
/**
|
|
19
|
-
* A collection of the focusable children of the view.
|
|
20
|
-
*/
|
|
21
|
-
items;
|
|
22
|
-
/**
|
|
23
|
-
* Tracks information about the DOM focus in the view.
|
|
24
|
-
*/
|
|
25
|
-
focusTracker;
|
|
26
|
-
/**
|
|
27
|
-
* An instance of the {@link module:utils/keystrokehandler~KeystrokeHandler}.
|
|
28
|
-
*/
|
|
29
|
-
keystrokes;
|
|
30
|
-
/**
|
|
31
|
-
* Helps cycling over focusable {@link #items} in the view.
|
|
32
|
-
*/
|
|
33
|
-
focusCycler;
|
|
34
|
-
/**
|
|
35
|
-
* An instance of the `EmojiSearchView`.
|
|
36
|
-
*/
|
|
37
|
-
searchView;
|
|
38
|
-
/**
|
|
39
|
-
* An instance of the `EmojiToneView`.
|
|
40
|
-
*/
|
|
41
|
-
toneView;
|
|
42
|
-
/**
|
|
43
|
-
* An instance of the `EmojiCategoriesView`.
|
|
44
|
-
*/
|
|
45
|
-
categoriesView;
|
|
46
|
-
/**
|
|
47
|
-
* An instance of the `EmojiGridView`.
|
|
48
|
-
*/
|
|
49
|
-
gridView;
|
|
50
|
-
/**
|
|
51
|
-
* An instance of the `EmojiGridView`.
|
|
52
|
-
*/
|
|
53
|
-
infoView;
|
|
54
18
|
/**
|
|
55
19
|
* @inheritDoc
|
|
56
20
|
*/
|
|
@@ -5,20 +5,12 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module emoji/ui/emojisearchview
|
|
7
7
|
*/
|
|
8
|
-
import { escapeRegExp } from 'es
|
|
8
|
+
import { escapeRegExp } from 'lodash-es';
|
|
9
9
|
import { createLabeledInputText, SearchTextView, View } from 'ckeditor5/src/ui.js';
|
|
10
10
|
/**
|
|
11
11
|
* A view responsible for providing an input element that allows filtering emoji by the provided query.
|
|
12
12
|
*/
|
|
13
13
|
export default class EmojiSearchView extends View {
|
|
14
|
-
/**
|
|
15
|
-
* The find in text input view that stores the searched string.
|
|
16
|
-
*/
|
|
17
|
-
inputView;
|
|
18
|
-
/**
|
|
19
|
-
* An instance of the `EmojiGridView`.
|
|
20
|
-
*/
|
|
21
|
-
gridView;
|
|
22
14
|
/**
|
|
23
15
|
* @inheritDoc
|
|
24
16
|
*/
|
package/src/ui/emojitoneview.js
CHANGED
|
@@ -12,14 +12,6 @@ import '../../theme/emojitone.css';
|
|
|
12
12
|
* A view responsible for selecting a skin tone for an emoji.
|
|
13
13
|
*/
|
|
14
14
|
export default class EmojiToneView extends View {
|
|
15
|
-
/**
|
|
16
|
-
* A dropdown element for selecting an active skin tone.
|
|
17
|
-
*/
|
|
18
|
-
dropdownView;
|
|
19
|
-
/**
|
|
20
|
-
* An array of available skin tones.
|
|
21
|
-
*/
|
|
22
|
-
_skinTones;
|
|
23
15
|
/**
|
|
24
16
|
* @inheritDoc
|
|
25
17
|
*/
|