@ckeditor/ckeditor5-emoji 44.3.0 → 45.0.0-alpha.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 +1 -1
- package/build/emoji.js +2 -2
- package/build/translations/af.js +1 -1
- package/build/translations/ar.js +1 -1
- package/build/translations/ast.js +1 -1
- package/build/translations/az.js +1 -1
- package/build/translations/be.js +1 -0
- package/build/translations/bg.js +1 -1
- package/build/translations/bn.js +1 -1
- package/build/translations/bs.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-ch.js +1 -1
- package/build/translations/de.js +1 -1
- package/build/translations/el.js +1 -1
- package/build/translations/en-au.js +1 -1
- package/build/translations/en-gb.js +1 -1
- package/build/translations/eo.js +1 -1
- package/build/translations/es-co.js +1 -1
- package/build/translations/es.js +1 -1
- package/build/translations/et.js +1 -1
- package/build/translations/eu.js +1 -1
- package/build/translations/fa.js +1 -1
- package/build/translations/fi.js +1 -1
- package/build/translations/fr.js +1 -1
- package/build/translations/gl.js +1 -1
- package/build/translations/gu.js +1 -1
- package/build/translations/he.js +1 -1
- package/build/translations/hi.js +1 -1
- package/build/translations/hr.js +1 -1
- package/build/translations/hu.js +1 -1
- package/build/translations/hy.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/jv.js +1 -1
- package/build/translations/kk.js +1 -1
- package/build/translations/km.js +1 -1
- package/build/translations/kn.js +1 -1
- package/build/translations/ko.js +1 -1
- package/build/translations/ku.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/nb.js +1 -1
- package/build/translations/ne.js +1 -1
- package/build/translations/nl.js +1 -1
- package/build/translations/no.js +1 -1
- package/build/translations/oc.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/si.js +1 -1
- package/build/translations/sk.js +1 -1
- package/build/translations/sl.js +1 -1
- package/build/translations/sq.js +1 -1
- package/build/translations/sr-latn.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/ti.js +1 -1
- package/build/translations/tk.js +1 -1
- package/build/translations/tr.js +1 -1
- package/build/translations/tt.js +1 -1
- package/build/translations/ug.js +1 -1
- package/build/translations/uk.js +1 -1
- package/build/translations/ur.js +1 -1
- package/build/translations/uz.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 +2 -2
- package/dist/index-editor.css +118 -0
- package/dist/index.css +157 -0
- package/dist/index.css.map +1 -1
- package/dist/index.js +151 -15
- package/dist/index.js.map +1 -1
- package/dist/translations/af.js +1 -1
- package/dist/translations/af.umd.js +1 -1
- package/dist/translations/ar.js +1 -1
- package/dist/translations/ar.umd.js +1 -1
- package/dist/translations/ast.js +1 -1
- package/dist/translations/ast.umd.js +1 -1
- package/dist/translations/az.js +1 -1
- package/dist/translations/az.umd.js +1 -1
- package/dist/translations/be.d.ts +8 -0
- package/dist/translations/be.js +5 -0
- package/dist/translations/be.umd.js +11 -0
- 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/bs.js +1 -1
- package/dist/translations/bs.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-ch.js +1 -1
- package/dist/translations/de-ch.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/en-au.js +1 -1
- package/dist/translations/en-au.umd.js +1 -1
- package/dist/translations/en-gb.js +1 -1
- package/dist/translations/en-gb.umd.js +1 -1
- package/dist/translations/en.js +1 -1
- package/dist/translations/en.umd.js +1 -1
- package/dist/translations/eo.js +1 -1
- package/dist/translations/eo.umd.js +1 -1
- package/dist/translations/es-co.js +1 -1
- package/dist/translations/es-co.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/eu.js +1 -1
- package/dist/translations/eu.umd.js +1 -1
- package/dist/translations/fa.js +1 -1
- package/dist/translations/fa.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/gl.js +1 -1
- package/dist/translations/gl.umd.js +1 -1
- package/dist/translations/gu.js +1 -1
- package/dist/translations/gu.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/hr.js +1 -1
- package/dist/translations/hr.umd.js +1 -1
- package/dist/translations/hu.js +1 -1
- package/dist/translations/hu.umd.js +1 -1
- package/dist/translations/hy.js +1 -1
- package/dist/translations/hy.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/jv.js +1 -1
- package/dist/translations/jv.umd.js +1 -1
- package/dist/translations/kk.js +1 -1
- package/dist/translations/kk.umd.js +1 -1
- package/dist/translations/km.js +1 -1
- package/dist/translations/km.umd.js +1 -1
- package/dist/translations/kn.js +1 -1
- package/dist/translations/kn.umd.js +1 -1
- package/dist/translations/ko.js +1 -1
- package/dist/translations/ko.umd.js +1 -1
- package/dist/translations/ku.js +1 -1
- package/dist/translations/ku.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/nb.js +1 -1
- package/dist/translations/nb.umd.js +1 -1
- package/dist/translations/ne.js +1 -1
- package/dist/translations/ne.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/oc.js +1 -1
- package/dist/translations/oc.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/si.js +1 -1
- package/dist/translations/si.umd.js +1 -1
- package/dist/translations/sk.js +1 -1
- package/dist/translations/sk.umd.js +1 -1
- package/dist/translations/sl.js +1 -1
- package/dist/translations/sl.umd.js +1 -1
- package/dist/translations/sq.js +1 -1
- package/dist/translations/sq.umd.js +1 -1
- package/dist/translations/sr-latn.js +1 -1
- package/dist/translations/sr-latn.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/ti.js +1 -1
- package/dist/translations/ti.umd.js +1 -1
- package/dist/translations/tk.js +1 -1
- package/dist/translations/tk.umd.js +1 -1
- package/dist/translations/tr.js +1 -1
- package/dist/translations/tr.umd.js +1 -1
- package/dist/translations/tt.js +1 -1
- package/dist/translations/tt.umd.js +1 -1
- package/dist/translations/ug.js +1 -1
- package/dist/translations/ug.umd.js +1 -1
- package/dist/translations/uk.js +1 -1
- package/dist/translations/uk.umd.js +1 -1
- package/dist/translations/ur.js +1 -1
- package/dist/translations/ur.umd.js +1 -1
- package/dist/translations/uz.js +1 -1
- package/dist/translations/uz.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/contexts.json +2 -1
- package/lang/translations/af.po +4 -0
- package/lang/translations/ar.po +4 -0
- package/lang/translations/ast.po +4 -0
- package/lang/translations/az.po +4 -0
- package/lang/translations/be.po +104 -0
- package/lang/translations/bg.po +4 -0
- package/lang/translations/bn.po +4 -0
- package/lang/translations/bs.po +4 -0
- package/lang/translations/ca.po +4 -0
- package/lang/translations/cs.po +4 -0
- package/lang/translations/da.po +4 -0
- package/lang/translations/de-ch.po +4 -0
- package/lang/translations/de.po +4 -0
- package/lang/translations/el.po +4 -0
- package/lang/translations/en-au.po +4 -0
- package/lang/translations/en-gb.po +4 -0
- package/lang/translations/en.po +4 -0
- package/lang/translations/eo.po +4 -0
- package/lang/translations/es-co.po +4 -0
- package/lang/translations/es.po +4 -0
- package/lang/translations/et.po +4 -0
- package/lang/translations/eu.po +4 -0
- package/lang/translations/fa.po +4 -0
- package/lang/translations/fi.po +4 -0
- package/lang/translations/fr.po +4 -0
- package/lang/translations/gl.po +4 -0
- package/lang/translations/gu.po +4 -0
- package/lang/translations/he.po +4 -0
- package/lang/translations/hi.po +4 -0
- package/lang/translations/hr.po +4 -0
- package/lang/translations/hu.po +4 -0
- package/lang/translations/hy.po +4 -0
- package/lang/translations/id.po +4 -0
- package/lang/translations/it.po +4 -0
- package/lang/translations/ja.po +4 -0
- package/lang/translations/jv.po +4 -0
- package/lang/translations/kk.po +4 -0
- package/lang/translations/km.po +4 -0
- package/lang/translations/kn.po +4 -0
- package/lang/translations/ko.po +4 -0
- package/lang/translations/ku.po +4 -0
- package/lang/translations/lt.po +4 -0
- package/lang/translations/lv.po +4 -0
- package/lang/translations/ms.po +4 -0
- package/lang/translations/nb.po +4 -0
- package/lang/translations/ne.po +4 -0
- package/lang/translations/nl.po +4 -0
- package/lang/translations/no.po +4 -0
- package/lang/translations/oc.po +4 -0
- package/lang/translations/pl.po +4 -0
- package/lang/translations/pt-br.po +4 -0
- package/lang/translations/pt.po +4 -0
- package/lang/translations/ro.po +4 -0
- package/lang/translations/ru.po +4 -0
- package/lang/translations/si.po +4 -0
- package/lang/translations/sk.po +4 -0
- package/lang/translations/sl.po +4 -0
- package/lang/translations/sq.po +4 -0
- package/lang/translations/sr-latn.po +4 -0
- package/lang/translations/sr.po +4 -0
- package/lang/translations/sv.po +4 -0
- package/lang/translations/th.po +4 -0
- package/lang/translations/ti.po +4 -0
- package/lang/translations/tk.po +4 -0
- package/lang/translations/tr.po +4 -0
- package/lang/translations/tt.po +4 -0
- package/lang/translations/ug.po +4 -0
- package/lang/translations/uk.po +4 -0
- package/lang/translations/ur.po +4 -0
- package/lang/translations/uz.po +4 -0
- package/lang/translations/vi.po +4 -0
- package/lang/translations/zh-cn.po +4 -0
- package/lang/translations/zh.po +4 -0
- package/package.json +9 -8
- package/src/emojimention.js +10 -0
- package/src/emojipicker.d.ts +9 -0
- package/src/emojipicker.js +32 -12
- package/src/emojirepository.js +20 -8
- package/src/emojiutils.js +6 -6
- package/src/ui/emojicategoriesview.js +16 -0
- package/src/ui/emojigridview.js +26 -0
- package/src/ui/emojipickerformview.d.ts +78 -0
- package/src/ui/emojipickerformview.js +146 -0
- package/src/ui/emojipickerview.js +36 -0
- package/src/ui/emojisearchview.js +9 -1
- package/src/ui/emojitoneview.js +8 -0
- package/theme/emojipicker.css +8 -0
- package/theme/emojipickerform.css +17 -0
package/src/emojimention.js
CHANGED
|
@@ -18,6 +18,16 @@ 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;
|
|
21
31
|
/**
|
|
22
32
|
* @inheritDoc
|
|
23
33
|
*/
|
package/src/emojipicker.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ import { Plugin } from 'ckeditor5/src/core.js';
|
|
|
10
10
|
import { Typing } from 'ckeditor5/src/typing.js';
|
|
11
11
|
import EmojiRepository from './emojirepository.js';
|
|
12
12
|
import EmojiPickerView from './ui/emojipickerview.js';
|
|
13
|
+
import EmojiPickerFormView from './ui/emojipickerformview.js';
|
|
13
14
|
import type { SkinToneId } from './emojiconfig.js';
|
|
14
15
|
import '../theme/emojipicker.css';
|
|
15
16
|
/**
|
|
@@ -22,6 +23,10 @@ export default class EmojiPicker extends Plugin {
|
|
|
22
23
|
* The actions view displayed inside the balloon.
|
|
23
24
|
*/
|
|
24
25
|
emojiPickerView: EmojiPickerView | undefined;
|
|
26
|
+
/**
|
|
27
|
+
* The form view displayed inside the balloon.
|
|
28
|
+
*/
|
|
29
|
+
emojiPickerFormView: EmojiPickerFormView | undefined;
|
|
25
30
|
/**
|
|
26
31
|
* The contextual balloon plugin instance.
|
|
27
32
|
*/
|
|
@@ -71,6 +76,10 @@ export default class EmojiPicker extends Plugin {
|
|
|
71
76
|
* Creates an instance of the `EmojiPickerView` class that represents an emoji balloon.
|
|
72
77
|
*/
|
|
73
78
|
private _createEmojiPickerView;
|
|
79
|
+
/**
|
|
80
|
+
* Creates an instance of the `EmojiPickerFormView` class that represents a balloon with the emoji picker.
|
|
81
|
+
*/
|
|
82
|
+
private _createEmojiPickerFormView;
|
|
74
83
|
/**
|
|
75
84
|
* Hides the balloon with the emoji picker.
|
|
76
85
|
*/
|
package/src/emojipicker.js
CHANGED
|
@@ -6,11 +6,13 @@
|
|
|
6
6
|
* @module emoji/emojipicker
|
|
7
7
|
*/
|
|
8
8
|
import { ButtonView, clickOutsideHandler, ContextualBalloon, Dialog, MenuBarMenuListItemButtonView } from 'ckeditor5/src/ui.js';
|
|
9
|
-
import {
|
|
9
|
+
import { Plugin } from 'ckeditor5/src/core.js';
|
|
10
10
|
import { Typing } from 'ckeditor5/src/typing.js';
|
|
11
|
+
import { IconEmoji } from 'ckeditor5/src/icons.js';
|
|
11
12
|
import EmojiCommand from './emojicommand.js';
|
|
12
13
|
import EmojiRepository from './emojirepository.js';
|
|
13
14
|
import EmojiPickerView from './ui/emojipickerview.js';
|
|
15
|
+
import EmojiPickerFormView from './ui/emojipickerformview.js';
|
|
14
16
|
import '../theme/emojipicker.css';
|
|
15
17
|
const VISUAL_SELECTION_MARKER_NAME = 'emoji-picker';
|
|
16
18
|
/**
|
|
@@ -99,10 +101,16 @@ export default class EmojiPicker extends Plugin {
|
|
|
99
101
|
this.emojiPickerView.searchView.setInputValue(searchValue);
|
|
100
102
|
}
|
|
101
103
|
this.emojiPickerView.searchView.search(searchValue);
|
|
102
|
-
if (!this.
|
|
104
|
+
if (!this.emojiPickerFormView) {
|
|
105
|
+
this.emojiPickerFormView = this._createEmojiPickerFormView();
|
|
106
|
+
}
|
|
107
|
+
if (!this.balloonPlugin.hasView(this.emojiPickerFormView)) {
|
|
108
|
+
// Show back button if there is another balloon view visible.
|
|
109
|
+
this.emojiPickerFormView.backButtonView.isVisible = !!this.balloonPlugin.visibleView;
|
|
103
110
|
this.balloonPlugin.add({
|
|
104
|
-
view: this.
|
|
105
|
-
position: this._getBalloonPositionData()
|
|
111
|
+
view: this.emojiPickerFormView,
|
|
112
|
+
position: this._getBalloonPositionData(),
|
|
113
|
+
balloonClassName: 'ck-emoji-picker-balloon'
|
|
106
114
|
});
|
|
107
115
|
}
|
|
108
116
|
this.emojiPickerView.focus();
|
|
@@ -116,7 +124,7 @@ export default class EmojiPicker extends Plugin {
|
|
|
116
124
|
buttonView.bind('isEnabled').to(command, 'isEnabled');
|
|
117
125
|
buttonView.set({
|
|
118
126
|
label: t('Emoji'),
|
|
119
|
-
icon:
|
|
127
|
+
icon: IconEmoji,
|
|
120
128
|
isToggleable: true
|
|
121
129
|
});
|
|
122
130
|
buttonView.on('execute', () => {
|
|
@@ -143,31 +151,43 @@ export default class EmojiPicker extends Plugin {
|
|
|
143
151
|
this._hideUI();
|
|
144
152
|
editor.execute('insertText', { text: textToInsert });
|
|
145
153
|
});
|
|
154
|
+
return emojiPickerView;
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Creates an instance of the `EmojiPickerFormView` class that represents a balloon with the emoji picker.
|
|
158
|
+
*/
|
|
159
|
+
_createEmojiPickerFormView() {
|
|
160
|
+
const emojiPickerFormView = new EmojiPickerFormView(this.editor.locale);
|
|
161
|
+
emojiPickerFormView.children.add(this.emojiPickerView);
|
|
146
162
|
// Update the balloon position when layout is changed.
|
|
147
|
-
this.listenTo(emojiPickerView, 'update', () => {
|
|
148
|
-
if (this.balloonPlugin.visibleView ===
|
|
163
|
+
this.listenTo(this.emojiPickerView, 'update', () => {
|
|
164
|
+
if (this.balloonPlugin.visibleView === emojiPickerFormView) {
|
|
149
165
|
this.balloonPlugin.updatePosition();
|
|
150
166
|
}
|
|
151
167
|
});
|
|
168
|
+
// Close the dialog when the back button is clicked.
|
|
169
|
+
this.listenTo(emojiPickerFormView, 'cancel', () => {
|
|
170
|
+
this._hideUI();
|
|
171
|
+
});
|
|
152
172
|
// Close the panel on `Esc` key press when the **actions have focus**.
|
|
153
|
-
|
|
173
|
+
emojiPickerFormView.keystrokes.set('Esc', (data, cancel) => {
|
|
154
174
|
this._hideUI();
|
|
155
175
|
cancel();
|
|
156
176
|
});
|
|
157
177
|
// Close the dialog when clicking outside of it.
|
|
158
178
|
clickOutsideHandler({
|
|
159
|
-
emitter:
|
|
179
|
+
emitter: emojiPickerFormView,
|
|
160
180
|
contextElements: [this.balloonPlugin.view.element],
|
|
161
181
|
callback: () => this._hideUI(),
|
|
162
|
-
activator: () => this.balloonPlugin.visibleView ===
|
|
182
|
+
activator: () => this.balloonPlugin.visibleView === emojiPickerFormView
|
|
163
183
|
});
|
|
164
|
-
return
|
|
184
|
+
return emojiPickerFormView;
|
|
165
185
|
}
|
|
166
186
|
/**
|
|
167
187
|
* Hides the balloon with the emoji picker.
|
|
168
188
|
*/
|
|
169
189
|
_hideUI() {
|
|
170
|
-
this.balloonPlugin.remove(this.
|
|
190
|
+
this.balloonPlugin.remove(this.emojiPickerFormView);
|
|
171
191
|
this.emojiPickerView.searchView.setInputValue('');
|
|
172
192
|
this.editor.editing.view.focus();
|
|
173
193
|
this._hideFakeVisualSelection();
|
package/src/emojirepository.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* @module emoji/emojirepository
|
|
7
7
|
*/
|
|
8
8
|
import fuzzysort from 'fuzzysort';
|
|
9
|
-
import { groupBy } from '
|
|
9
|
+
import { groupBy } from 'es-toolkit/compat';
|
|
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,6 +20,19 @@ 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
|
+
* Emoji repository in a configured version.
|
|
25
|
+
*/
|
|
26
|
+
_items;
|
|
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;
|
|
23
36
|
/**
|
|
24
37
|
* @inheritDoc
|
|
25
38
|
*/
|
|
@@ -104,8 +117,7 @@ class EmojiRepository extends Plugin {
|
|
|
104
117
|
// It enables searching in tags with the space character in names.
|
|
105
118
|
const searchQueryTokens = searchQuery.split(/\s/).filter(Boolean);
|
|
106
119
|
const matchedTags = searchQueryTokens.flatMap(tok => {
|
|
107
|
-
|
|
108
|
-
return (_a = emojiEntry.tags) === null || _a === void 0 ? void 0 : _a.filter(t => t.startsWith(tok));
|
|
120
|
+
return emojiEntry.tags?.filter(t => t.startsWith(tok));
|
|
109
121
|
});
|
|
110
122
|
return matchedTags.join();
|
|
111
123
|
}
|
|
@@ -136,7 +148,7 @@ class EmojiRepository extends Plugin {
|
|
|
136
148
|
{ title: t('Symbols'), icon: '🔵', groupId: 8 },
|
|
137
149
|
{ title: t('Flags'), icon: '🏁', groupId: 9 }
|
|
138
150
|
];
|
|
139
|
-
const groups = groupBy(repository,
|
|
151
|
+
const groups = groupBy(repository, item => item.group);
|
|
140
152
|
return categories.map(category => {
|
|
141
153
|
return {
|
|
142
154
|
...category,
|
|
@@ -278,11 +290,11 @@ class EmojiRepository extends Plugin {
|
|
|
278
290
|
container.remove();
|
|
279
291
|
return results;
|
|
280
292
|
}
|
|
293
|
+
/**
|
|
294
|
+
* Versioned emoji repository.
|
|
295
|
+
*/
|
|
296
|
+
static _results = {};
|
|
281
297
|
}
|
|
282
|
-
/**
|
|
283
|
-
* Versioned emoji repository.
|
|
284
|
-
*/
|
|
285
|
-
EmojiRepository._results = {};
|
|
286
298
|
export default EmojiRepository;
|
|
287
299
|
/**
|
|
288
300
|
* Unable to load the emoji repository from the URL.
|
package/src/emojiutils.js
CHANGED
|
@@ -142,11 +142,11 @@ class EmojiUtils extends Plugin {
|
|
|
142
142
|
// Category group=2 contains skin tones only, which we do not want to render.
|
|
143
143
|
return item.group !== 2;
|
|
144
144
|
}
|
|
145
|
+
/**
|
|
146
|
+
* A function used to determine if emoji is supported by detecting pixels.
|
|
147
|
+
*
|
|
148
|
+
* Referenced for unit testing purposes. Kept in a separate file because of licensing.
|
|
149
|
+
*/
|
|
150
|
+
static _isEmojiSupported = isEmojiSupported;
|
|
145
151
|
}
|
|
146
|
-
/**
|
|
147
|
-
* A function used to determine if emoji is supported by detecting pixels.
|
|
148
|
-
*
|
|
149
|
-
* Referenced for unit testing purposes. Kept in a separate file because of licensing.
|
|
150
|
-
*/
|
|
151
|
-
EmojiUtils._isEmojiSupported = isEmojiSupported;
|
|
152
152
|
export default EmojiUtils;
|
|
@@ -13,6 +13,22 @@ 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;
|
|
16
32
|
/**
|
|
17
33
|
* @inheritDoc
|
|
18
34
|
*/
|
package/src/ui/emojigridview.js
CHANGED
|
@@ -12,6 +12,32 @@ 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;
|
|
15
41
|
/**
|
|
16
42
|
* @inheritDoc
|
|
17
43
|
*/
|
|
@@ -0,0 +1,78 @@
|
|
|
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/ui/emojipickerformview
|
|
7
|
+
*/
|
|
8
|
+
import { ButtonView, View, ViewCollection } from 'ckeditor5/src/ui.js';
|
|
9
|
+
import { FocusTracker, KeystrokeHandler, type Locale } from 'ckeditor5/src/utils.js';
|
|
10
|
+
import '@ckeditor/ckeditor5-ui/theme/components/responsive-form/responsiveform.css';
|
|
11
|
+
import '@ckeditor/ckeditor5-ui/theme/components/form/form.css';
|
|
12
|
+
import '../../theme/emojipickerform.css';
|
|
13
|
+
/**
|
|
14
|
+
* The emoji picker form view.
|
|
15
|
+
*/
|
|
16
|
+
export default class EmojiPickerFormView extends View {
|
|
17
|
+
/**
|
|
18
|
+
* The Back button view displayed in the header.
|
|
19
|
+
*/
|
|
20
|
+
backButtonView: ButtonView;
|
|
21
|
+
/**
|
|
22
|
+
* Tracks information about DOM focus in the form.
|
|
23
|
+
*/
|
|
24
|
+
readonly focusTracker: FocusTracker;
|
|
25
|
+
/**
|
|
26
|
+
* An instance of the {@link module:utils/keystrokehandler~KeystrokeHandler}.
|
|
27
|
+
*/
|
|
28
|
+
readonly keystrokes: KeystrokeHandler;
|
|
29
|
+
/**
|
|
30
|
+
* A collection of child views.
|
|
31
|
+
*/
|
|
32
|
+
readonly children: ViewCollection;
|
|
33
|
+
/**
|
|
34
|
+
* A collection of views that can be focused in the form.
|
|
35
|
+
*/
|
|
36
|
+
private readonly _focusables;
|
|
37
|
+
/**
|
|
38
|
+
* Helps cycling over {@link #_focusables} in the form.
|
|
39
|
+
*/
|
|
40
|
+
private readonly _focusCycler;
|
|
41
|
+
/**
|
|
42
|
+
* Creates an instance of the {@link module:emoji/ui/emojipickerformview~EmojiPickerFormView} class.
|
|
43
|
+
*
|
|
44
|
+
* Also see {@link #render}.
|
|
45
|
+
*
|
|
46
|
+
* @param locale The localization services instance.
|
|
47
|
+
*/
|
|
48
|
+
constructor(locale: Locale);
|
|
49
|
+
/**
|
|
50
|
+
* @inheritDoc
|
|
51
|
+
*/
|
|
52
|
+
render(): void;
|
|
53
|
+
/**
|
|
54
|
+
* @inheritDoc
|
|
55
|
+
*/
|
|
56
|
+
destroy(): void;
|
|
57
|
+
/**
|
|
58
|
+
* Focuses the fist {@link #_focusables} in the form.
|
|
59
|
+
*/
|
|
60
|
+
focus(): void;
|
|
61
|
+
/**
|
|
62
|
+
* Creates a back button view that cancels the form.
|
|
63
|
+
*/
|
|
64
|
+
private _createBackButton;
|
|
65
|
+
/**
|
|
66
|
+
* Creates a header view for the form.
|
|
67
|
+
*/
|
|
68
|
+
private _createHeaderView;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Fired when the form view is canceled, for example with a click on {@link ~EmojiPickerFormView#backButtonView}.
|
|
72
|
+
*
|
|
73
|
+
* @eventName ~EmojiPickerFormView#cancel
|
|
74
|
+
*/
|
|
75
|
+
export type EmojiPickerFormViewCancelEvent = {
|
|
76
|
+
name: 'cancel';
|
|
77
|
+
args: [];
|
|
78
|
+
};
|
|
@@ -0,0 +1,146 @@
|
|
|
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/ui/emojipickerformview
|
|
7
|
+
*/
|
|
8
|
+
import { ButtonView, FocusCycler, FormHeaderView, View, ViewCollection, isFocusable, isViewWithFocusCycler } from 'ckeditor5/src/ui.js';
|
|
9
|
+
import { FocusTracker, KeystrokeHandler } from 'ckeditor5/src/utils.js';
|
|
10
|
+
import { IconPreviousArrow } from 'ckeditor5/src/icons.js';
|
|
11
|
+
// See: https://github.com/ckeditor/ckeditor5/issues/8833
|
|
12
|
+
// eslint-disable-next-line ckeditor5-rules/ckeditor-imports
|
|
13
|
+
import '@ckeditor/ckeditor5-ui/theme/components/responsive-form/responsiveform.css';
|
|
14
|
+
// eslint-disable-next-line ckeditor5-rules/ckeditor-imports
|
|
15
|
+
import '@ckeditor/ckeditor5-ui/theme/components/form/form.css';
|
|
16
|
+
import '../../theme/emojipickerform.css';
|
|
17
|
+
/**
|
|
18
|
+
* The emoji picker form view.
|
|
19
|
+
*/
|
|
20
|
+
export default class EmojiPickerFormView extends View {
|
|
21
|
+
/**
|
|
22
|
+
* The Back button view displayed in the header.
|
|
23
|
+
*/
|
|
24
|
+
backButtonView;
|
|
25
|
+
/**
|
|
26
|
+
* Tracks information about DOM focus in the form.
|
|
27
|
+
*/
|
|
28
|
+
focusTracker = new FocusTracker();
|
|
29
|
+
/**
|
|
30
|
+
* An instance of the {@link module:utils/keystrokehandler~KeystrokeHandler}.
|
|
31
|
+
*/
|
|
32
|
+
keystrokes = new KeystrokeHandler();
|
|
33
|
+
/**
|
|
34
|
+
* A collection of child views.
|
|
35
|
+
*/
|
|
36
|
+
children;
|
|
37
|
+
/**
|
|
38
|
+
* A collection of views that can be focused in the form.
|
|
39
|
+
*/
|
|
40
|
+
_focusables = new ViewCollection();
|
|
41
|
+
/**
|
|
42
|
+
* Helps cycling over {@link #_focusables} in the form.
|
|
43
|
+
*/
|
|
44
|
+
_focusCycler;
|
|
45
|
+
/**
|
|
46
|
+
* Creates an instance of the {@link module:emoji/ui/emojipickerformview~EmojiPickerFormView} class.
|
|
47
|
+
*
|
|
48
|
+
* Also see {@link #render}.
|
|
49
|
+
*
|
|
50
|
+
* @param locale The localization services instance.
|
|
51
|
+
*/
|
|
52
|
+
constructor(locale) {
|
|
53
|
+
super(locale);
|
|
54
|
+
this.backButtonView = this._createBackButton();
|
|
55
|
+
this.children = this.createCollection([
|
|
56
|
+
this._createHeaderView()
|
|
57
|
+
]);
|
|
58
|
+
this._focusCycler = new FocusCycler({
|
|
59
|
+
focusables: this._focusables,
|
|
60
|
+
focusTracker: this.focusTracker,
|
|
61
|
+
keystrokeHandler: this.keystrokes,
|
|
62
|
+
actions: {
|
|
63
|
+
// Navigate form fields backward using the Shift + Tab keystroke.
|
|
64
|
+
focusPrevious: 'shift + tab',
|
|
65
|
+
// Navigate form fields forwards using the Tab key.
|
|
66
|
+
focusNext: 'tab'
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
this.setTemplate({
|
|
70
|
+
tag: 'div',
|
|
71
|
+
attributes: {
|
|
72
|
+
class: [
|
|
73
|
+
'ck',
|
|
74
|
+
'ck-form',
|
|
75
|
+
'ck-emoji-picker-form',
|
|
76
|
+
'ck-responsive-form'
|
|
77
|
+
],
|
|
78
|
+
// https://github.com/ckeditor/ckeditor5-link/issues/90
|
|
79
|
+
tabindex: '-1'
|
|
80
|
+
},
|
|
81
|
+
children: this.children
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* @inheritDoc
|
|
86
|
+
*/
|
|
87
|
+
render() {
|
|
88
|
+
super.render();
|
|
89
|
+
const childViews = [
|
|
90
|
+
...this.children.filter(isFocusable),
|
|
91
|
+
this.backButtonView
|
|
92
|
+
];
|
|
93
|
+
childViews.forEach(v => {
|
|
94
|
+
// Register the view as focusable.
|
|
95
|
+
this._focusables.add(v);
|
|
96
|
+
// Register the view in the focus tracker.
|
|
97
|
+
this.focusTracker.add(v.element);
|
|
98
|
+
// Register the view in the focus cycler to avoid nested focus cycles traps.
|
|
99
|
+
if (isViewWithFocusCycler(v)) {
|
|
100
|
+
this._focusCycler.chain(v.focusCycler);
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
// Start listening for the keystrokes coming from #element.
|
|
104
|
+
this.keystrokes.listenTo(this.element);
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* @inheritDoc
|
|
108
|
+
*/
|
|
109
|
+
destroy() {
|
|
110
|
+
super.destroy();
|
|
111
|
+
this.focusTracker.destroy();
|
|
112
|
+
this.keystrokes.destroy();
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Focuses the fist {@link #_focusables} in the form.
|
|
116
|
+
*/
|
|
117
|
+
focus() {
|
|
118
|
+
this._focusCycler.focusFirst();
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Creates a back button view that cancels the form.
|
|
122
|
+
*/
|
|
123
|
+
_createBackButton() {
|
|
124
|
+
const t = this.locale.t;
|
|
125
|
+
const backButton = new ButtonView(this.locale);
|
|
126
|
+
backButton.set({
|
|
127
|
+
class: 'ck-button-back',
|
|
128
|
+
label: t('Back'),
|
|
129
|
+
icon: IconPreviousArrow,
|
|
130
|
+
tooltip: true
|
|
131
|
+
});
|
|
132
|
+
backButton.delegate('execute').to(this, 'cancel');
|
|
133
|
+
return backButton;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Creates a header view for the form.
|
|
137
|
+
*/
|
|
138
|
+
_createHeaderView() {
|
|
139
|
+
const t = this.locale.t;
|
|
140
|
+
const header = new FormHeaderView(this.locale, {
|
|
141
|
+
label: t('Emoji picker')
|
|
142
|
+
});
|
|
143
|
+
header.children.add(this.backButtonView, 0);
|
|
144
|
+
return header;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
@@ -15,6 +15,42 @@ 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;
|
|
18
54
|
/**
|
|
19
55
|
* @inheritDoc
|
|
20
56
|
*/
|
|
@@ -5,12 +5,20 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module emoji/ui/emojisearchview
|
|
7
7
|
*/
|
|
8
|
-
import { escapeRegExp } from '
|
|
8
|
+
import { escapeRegExp } from 'es-toolkit/compat';
|
|
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;
|
|
14
22
|
/**
|
|
15
23
|
* @inheritDoc
|
|
16
24
|
*/
|
package/src/ui/emojitoneview.js
CHANGED
|
@@ -12,6 +12,14 @@ 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;
|
|
15
23
|
/**
|
|
16
24
|
* @inheritDoc
|
|
17
25
|
*/
|
package/theme/emojipicker.css
CHANGED
|
@@ -13,6 +13,10 @@
|
|
|
13
13
|
padding-bottom: var(--ck-spacing-medium);
|
|
14
14
|
justify-content: space-between;
|
|
15
15
|
align-items: center;
|
|
16
|
+
|
|
17
|
+
& > .ck.ck-search {
|
|
18
|
+
flex: 1;
|
|
19
|
+
}
|
|
16
20
|
}
|
|
17
21
|
|
|
18
22
|
/*
|
|
@@ -30,3 +34,7 @@
|
|
|
30
34
|
margin-right: -1px;
|
|
31
35
|
outline: solid 1px hsla(0, 0%, 100%, .5);
|
|
32
36
|
}
|
|
37
|
+
|
|
38
|
+
div.ck.ck-balloon-panel.ck-emoji-picker-balloon {
|
|
39
|
+
z-index: calc( var( --ck-z-dialog ) + 1 );
|
|
40
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* 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
|
+
.ck.ck-form.ck-emoji-picker-form {
|
|
7
|
+
padding-bottom: 0;
|
|
8
|
+
|
|
9
|
+
/*
|
|
10
|
+
* `.ck-form` overrides styling of all dropdowns by adding border around them.
|
|
11
|
+
* The border is not needed in the emoji picker form so try to remove it keeping
|
|
12
|
+
* specificity high enough to override the form styling.
|
|
13
|
+
*/
|
|
14
|
+
& .ck.ck-dropdown .ck-dropdown__button:not(:focus) {
|
|
15
|
+
border-color: transparent;
|
|
16
|
+
}
|
|
17
|
+
}
|