@ckeditor/ckeditor5-emoji 0.0.0-nightly-next-20250217.0 → 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +5 -15
- package/README.md +3 -30
- package/package.json +5 -59
- package/CHANGELOG.md +0 -4
- package/build/emoji.js +0 -4
- package/ckeditor5-metadata.json +0 -32
- package/dist/index-content.css +0 -4
- package/dist/index-editor.css +0 -111
- package/dist/index.css +0 -143
- package/dist/index.css.map +0 -1
- package/dist/index.js +0 -1478
- package/dist/index.js.map +0 -1
- package/lang/contexts.json +0 -24
- package/src/augmentation.d.ts +0 -24
- package/src/augmentation.js +0 -5
- package/src/emoji.d.ts +0 -32
- package/src/emoji.js +0 -38
- package/src/emojicommand.d.ts +0 -24
- package/src/emojicommand.js +0 -33
- package/src/emojiconfig.d.ts +0 -80
- package/src/emojiconfig.js +0 -5
- package/src/emojimention.d.ts +0 -68
- package/src/emojimention.js +0 -203
- package/src/emojipicker.d.ts +0 -97
- package/src/emojipicker.js +0 -256
- package/src/emojirepository.d.ts +0 -139
- package/src/emojirepository.js +0 -280
- package/src/index.d.ts +0 -14
- package/src/index.js +0 -13
- package/src/ui/emojicategoriesview.d.ts +0 -68
- package/src/ui/emojicategoriesview.js +0 -147
- package/src/ui/emojigridview.d.ts +0 -140
- package/src/ui/emojigridview.js +0 -209
- package/src/ui/emojipickerview.d.ts +0 -91
- package/src/ui/emojipickerview.js +0 -208
- package/src/ui/emojisearchview.d.ts +0 -51
- package/src/ui/emojisearchview.js +0 -97
- package/src/ui/emojitoneview.d.ts +0 -46
- package/src/ui/emojitoneview.js +0 -97
- package/theme/emojicategories.css +0 -29
- package/theme/emojigrid.css +0 -55
- package/theme/emojipicker.css +0 -32
- package/theme/emojitone.css +0 -21
package/lang/contexts.json
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"Emoji": "Toolbar button tooltip for the Emoji feature.",
|
|
3
|
-
"Show all emoji...": "Dropdown option label for opening an emoji picker offering more results to choose from.",
|
|
4
|
-
"Find an emoji (min. 2 characters)": "Label of an input field for filtering an emoji collection by the typed value.",
|
|
5
|
-
"No emojis were found matching \"%0\".": "The main text of the message shown to the user when no emoji are available for the search criteria.",
|
|
6
|
-
"Keep on typing to see the emoji.": "The main text of the message shown to the user when the provided search query does not contain the required number of characters.",
|
|
7
|
-
"The query must contain at least two characters.": "The secondary text of the message shown to the user to explain how many characters the search query must consist of.",
|
|
8
|
-
"Smileys & Expressions": "Tooltip for filtering the displayed emoji by the \"Smileys & Expressions\" category.",
|
|
9
|
-
"Gestures & People": "Tooltip for filtering the displayed emoji by the \"Gestures & People\" category.",
|
|
10
|
-
"Animals & Nature": "Tooltip for filtering the displayed emoji by the \"Animals & Nature\" category.",
|
|
11
|
-
"Food & Drinks": "Tooltip for filtering the displayed emoji by the \"Food & Drinks\" category.",
|
|
12
|
-
"Travel & Places": "Tooltip for filtering the displayed emoji by the \"Travel & Places\" category.",
|
|
13
|
-
"Activities": "Tooltip for filtering the displayed emoji by the \"Activities\" category.",
|
|
14
|
-
"Objects": "Tooltip for filtering the displayed emoji by the \"Objects\" category.",
|
|
15
|
-
"Symbols": "Tooltip for filtering the displayed emoji by the \"Symbols\" category.",
|
|
16
|
-
"Flags": "Tooltip for filtering the displayed emoji by the \"Flags\" category.",
|
|
17
|
-
"Select skin tone": "Default label for the emoji skin tone dropdown.",
|
|
18
|
-
"Default skin tone": "Dropdown option label for using the \"Default skin tone\" variant. Example emoji: 👋.",
|
|
19
|
-
"Light skin tone": "Dropdown option label for using the \"Light skin tone\" variant. Example emoji: 👋🏻.",
|
|
20
|
-
"Medium Light skin tone": "Dropdown option label for using the \"Medium Light skin tone\" variant. Example emoji: 👋🏼.",
|
|
21
|
-
"Medium skin tone": "Dropdown option label for using the \"Medium skin tone\" variant. Example emoji: 👋🏽.",
|
|
22
|
-
"Medium Dark skin tone": "Dropdown option label for using the \"Medium Dark skin tone\" variant. Example emoji: 👋🏾.",
|
|
23
|
-
"Dark skin tone": "Dropdown option label for using the \"Dark skin tone\" variant. Example emoji: 👋🏿."
|
|
24
|
-
}
|
package/src/augmentation.d.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
-
*/
|
|
5
|
-
import type { Emoji, EmojiConfig, EmojiMention, EmojiPicker, EmojiRepository, EmojiCommand } from './index.js';
|
|
6
|
-
declare module '@ckeditor/ckeditor5-core' {
|
|
7
|
-
interface EditorConfig {
|
|
8
|
-
/**
|
|
9
|
-
* The configuration of the {@link module:emoji/emoji~Emoji} feature.
|
|
10
|
-
*
|
|
11
|
-
* Read more in {@link module:emoji/emojiconfig~EmojiConfig}.
|
|
12
|
-
*/
|
|
13
|
-
emoji?: EmojiConfig;
|
|
14
|
-
}
|
|
15
|
-
interface PluginsMap {
|
|
16
|
-
[Emoji.pluginName]: Emoji;
|
|
17
|
-
[EmojiMention.pluginName]: EmojiMention;
|
|
18
|
-
[EmojiPicker.pluginName]: EmojiPicker;
|
|
19
|
-
[EmojiRepository.pluginName]: EmojiRepository;
|
|
20
|
-
}
|
|
21
|
-
interface CommandsMap {
|
|
22
|
-
emoji: EmojiCommand;
|
|
23
|
-
}
|
|
24
|
-
}
|
package/src/augmentation.js
DELETED
package/src/emoji.d.ts
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* @module emoji/emoji
|
|
7
|
-
*/
|
|
8
|
-
import { Plugin } from 'ckeditor5/src/core.js';
|
|
9
|
-
import EmojiMention from './emojimention.js';
|
|
10
|
-
import EmojiPicker from './emojipicker.js';
|
|
11
|
-
/**
|
|
12
|
-
* The emoji plugin.
|
|
13
|
-
*
|
|
14
|
-
* This is a "glue" plugin which loads the following plugins:
|
|
15
|
-
*
|
|
16
|
-
* * {@link module:emoji/emojimention~EmojiMention},
|
|
17
|
-
* * {@link module:emoji/emojipicker~EmojiPicker},
|
|
18
|
-
*/
|
|
19
|
-
export default class Emoji extends Plugin {
|
|
20
|
-
/**
|
|
21
|
-
* @inheritDoc
|
|
22
|
-
*/
|
|
23
|
-
static get requires(): readonly [typeof EmojiMention, typeof EmojiPicker];
|
|
24
|
-
/**
|
|
25
|
-
* @inheritDoc
|
|
26
|
-
*/
|
|
27
|
-
static get pluginName(): "Emoji";
|
|
28
|
-
/**
|
|
29
|
-
* @inheritDoc
|
|
30
|
-
*/
|
|
31
|
-
static get isOfficialPlugin(): true;
|
|
32
|
-
}
|
package/src/emoji.js
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* @module emoji/emoji
|
|
7
|
-
*/
|
|
8
|
-
import { Plugin } from 'ckeditor5/src/core.js';
|
|
9
|
-
import EmojiMention from './emojimention.js';
|
|
10
|
-
import EmojiPicker from './emojipicker.js';
|
|
11
|
-
/**
|
|
12
|
-
* The emoji plugin.
|
|
13
|
-
*
|
|
14
|
-
* This is a "glue" plugin which loads the following plugins:
|
|
15
|
-
*
|
|
16
|
-
* * {@link module:emoji/emojimention~EmojiMention},
|
|
17
|
-
* * {@link module:emoji/emojipicker~EmojiPicker},
|
|
18
|
-
*/
|
|
19
|
-
export default class Emoji extends Plugin {
|
|
20
|
-
/**
|
|
21
|
-
* @inheritDoc
|
|
22
|
-
*/
|
|
23
|
-
static get requires() {
|
|
24
|
-
return [EmojiMention, EmojiPicker];
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* @inheritDoc
|
|
28
|
-
*/
|
|
29
|
-
static get pluginName() {
|
|
30
|
-
return 'Emoji';
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* @inheritDoc
|
|
34
|
-
*/
|
|
35
|
-
static get isOfficialPlugin() {
|
|
36
|
-
return true;
|
|
37
|
-
}
|
|
38
|
-
}
|
package/src/emojicommand.d.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* @module emoji/emojicommand
|
|
7
|
-
*/
|
|
8
|
-
import { Command } from 'ckeditor5/src/core.js';
|
|
9
|
-
/**
|
|
10
|
-
* Command that shows the emoji user interface.
|
|
11
|
-
*/
|
|
12
|
-
export default class EmojiCommand extends Command {
|
|
13
|
-
/**
|
|
14
|
-
* Updates the command's {@link #isEnabled} based on the current selection.
|
|
15
|
-
*/
|
|
16
|
-
refresh(): void;
|
|
17
|
-
/**
|
|
18
|
-
* Opens emoji user interface for the current document selection.
|
|
19
|
-
*
|
|
20
|
-
* @fires execute
|
|
21
|
-
* @param [searchValue=''] A default query used to filer the grid when opening the UI.
|
|
22
|
-
*/
|
|
23
|
-
execute(searchValue?: string): void;
|
|
24
|
-
}
|
package/src/emojicommand.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* @module emoji/emojicommand
|
|
7
|
-
*/
|
|
8
|
-
import { Command } from 'ckeditor5/src/core.js';
|
|
9
|
-
/**
|
|
10
|
-
* Command that shows the emoji user interface.
|
|
11
|
-
*/
|
|
12
|
-
export default class EmojiCommand extends Command {
|
|
13
|
-
/**
|
|
14
|
-
* Updates the command's {@link #isEnabled} based on the current selection.
|
|
15
|
-
*/
|
|
16
|
-
refresh() {
|
|
17
|
-
const editor = this.editor;
|
|
18
|
-
const model = editor.model;
|
|
19
|
-
const schema = model.schema;
|
|
20
|
-
const selection = model.document.selection;
|
|
21
|
-
this.isEnabled = schema.checkChild(selection.getFirstPosition(), '$text');
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Opens emoji user interface for the current document selection.
|
|
25
|
-
*
|
|
26
|
-
* @fires execute
|
|
27
|
-
* @param [searchValue=''] A default query used to filer the grid when opening the UI.
|
|
28
|
-
*/
|
|
29
|
-
execute(searchValue = '') {
|
|
30
|
-
const emojiPickerPlugin = this.editor.plugins.get('EmojiPicker');
|
|
31
|
-
emojiPickerPlugin.showUI(searchValue);
|
|
32
|
-
}
|
|
33
|
-
}
|
package/src/emojiconfig.d.ts
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* @module emoji/emojiconfig
|
|
7
|
-
*/
|
|
8
|
-
/**
|
|
9
|
-
* The configuration of the emoji feature.
|
|
10
|
-
*
|
|
11
|
-
* Read more about {@glink features/emoji#configuration configuring the emoji feature}.
|
|
12
|
-
*
|
|
13
|
-
* ```ts
|
|
14
|
-
* ClassicEditor
|
|
15
|
-
* .create( editorElement, {
|
|
16
|
-
* emoji: ... // Emoji feature options.
|
|
17
|
-
* } )
|
|
18
|
-
* .then( ... )
|
|
19
|
-
* .catch( ... );
|
|
20
|
-
* ```
|
|
21
|
-
*
|
|
22
|
-
* See {@link module:core/editor/editorconfig~EditorConfig all editor configuration options}.
|
|
23
|
-
*/
|
|
24
|
-
export interface EmojiConfig {
|
|
25
|
-
/**
|
|
26
|
-
* The maximum number of emojis displayed in the dropdown list.
|
|
27
|
-
*
|
|
28
|
-
* ```ts
|
|
29
|
-
* ClassicEditor
|
|
30
|
-
* .create( editorElement, {
|
|
31
|
-
* plugins: [ Emoji, ... ],
|
|
32
|
-
* emoji: {
|
|
33
|
-
* dropdownLimit: 4
|
|
34
|
-
* }
|
|
35
|
-
* } )
|
|
36
|
-
* .then( ... )
|
|
37
|
-
* .catch( ... );
|
|
38
|
-
* ```
|
|
39
|
-
*
|
|
40
|
-
* @default 6
|
|
41
|
-
*/
|
|
42
|
-
dropdownLimit?: number;
|
|
43
|
-
/**
|
|
44
|
-
* Initial skin tone for the emojis that support skin tones.
|
|
45
|
-
*
|
|
46
|
-
* ```ts
|
|
47
|
-
* ClassicEditor
|
|
48
|
-
* .create( editorElement, {
|
|
49
|
-
* plugins: [ Emoji, ... ],
|
|
50
|
-
* emoji: {
|
|
51
|
-
* skinTone: 'medium'
|
|
52
|
-
* }
|
|
53
|
-
* } )
|
|
54
|
-
* .then( ... )
|
|
55
|
-
* .catch( ... );
|
|
56
|
-
* ```
|
|
57
|
-
*
|
|
58
|
-
* @default 'default'
|
|
59
|
-
*/
|
|
60
|
-
skinTone?: SkinToneId;
|
|
61
|
-
/**
|
|
62
|
-
* The emoji database version.
|
|
63
|
-
*
|
|
64
|
-
* ```ts
|
|
65
|
-
* ClassicEditor
|
|
66
|
-
* .create( editorElement, {
|
|
67
|
-
* plugins: [ Emoji, ... ],
|
|
68
|
-
* emoji: {
|
|
69
|
-
* version: 15
|
|
70
|
-
* }
|
|
71
|
-
* } )
|
|
72
|
-
* .then( ... )
|
|
73
|
-
* .catch( ... );
|
|
74
|
-
* ```
|
|
75
|
-
*
|
|
76
|
-
* @default 16
|
|
77
|
-
*/
|
|
78
|
-
version?: 15 | 16;
|
|
79
|
-
}
|
|
80
|
-
export type SkinToneId = 'default' | 'light' | 'medium-light' | 'medium' | 'medium-dark' | 'dark';
|
package/src/emojiconfig.js
DELETED
package/src/emojimention.d.ts
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
-
*/
|
|
5
|
-
import { Plugin, type Editor } from 'ckeditor5/src/core.js';
|
|
6
|
-
import { Typing } from 'ckeditor5/src/typing.js';
|
|
7
|
-
import EmojiRepository from './emojirepository.js';
|
|
8
|
-
/**
|
|
9
|
-
* The emoji mention plugin.
|
|
10
|
-
*
|
|
11
|
-
* Introduces the autocomplete of emojis while typing.
|
|
12
|
-
*/
|
|
13
|
-
export default class EmojiMention extends Plugin {
|
|
14
|
-
/**
|
|
15
|
-
* An instance of the {@link module:emoji/emojipicker~EmojiPicker} plugin if it is loaded in the editor.
|
|
16
|
-
*/
|
|
17
|
-
private _emojiPickerPlugin;
|
|
18
|
-
/**
|
|
19
|
-
* An instance of the {@link module:emoji/emojirepository~EmojiRepository} plugin.
|
|
20
|
-
*/
|
|
21
|
-
private _emojiRepositoryPlugin;
|
|
22
|
-
/**
|
|
23
|
-
* Defines a number of displayed items in the auto complete dropdown.
|
|
24
|
-
*
|
|
25
|
-
* It includes the "Show all emoji..." option if the `EmojiPicker` plugin is loaded.
|
|
26
|
-
*/
|
|
27
|
-
private readonly _emojiDropdownLimit;
|
|
28
|
-
/**
|
|
29
|
-
* Defines a skin tone that is set in the emoji config.
|
|
30
|
-
*/
|
|
31
|
-
private readonly _skinTone;
|
|
32
|
-
/**
|
|
33
|
-
* @inheritDoc
|
|
34
|
-
*/
|
|
35
|
-
static get requires(): readonly [typeof EmojiRepository, typeof Typing, "Mention"];
|
|
36
|
-
/**
|
|
37
|
-
* @inheritDoc
|
|
38
|
-
*/
|
|
39
|
-
static get pluginName(): "EmojiMention";
|
|
40
|
-
/**
|
|
41
|
-
* @inheritDoc
|
|
42
|
-
*/
|
|
43
|
-
static get isOfficialPlugin(): true;
|
|
44
|
-
/**
|
|
45
|
-
* @inheritDoc
|
|
46
|
-
*/
|
|
47
|
-
constructor(editor: Editor);
|
|
48
|
-
/**
|
|
49
|
-
* @inheritDoc
|
|
50
|
-
*/
|
|
51
|
-
init(): Promise<void>;
|
|
52
|
-
/**
|
|
53
|
-
* Initializes the configuration for emojis in the mention feature.
|
|
54
|
-
*/
|
|
55
|
-
private _setupMentionConfiguration;
|
|
56
|
-
/**
|
|
57
|
-
* Returns the `itemRenderer()` callback for mention config.
|
|
58
|
-
*/
|
|
59
|
-
private _customItemRendererFactory;
|
|
60
|
-
/**
|
|
61
|
-
* Overrides the default mention execute listener to insert an emoji as plain text instead.
|
|
62
|
-
*/
|
|
63
|
-
private _overrideMentionExecuteListener;
|
|
64
|
-
/**
|
|
65
|
-
* Returns the `feed()` callback for mention config.
|
|
66
|
-
*/
|
|
67
|
-
private _queryEmojiCallbackFactory;
|
|
68
|
-
}
|
package/src/emojimention.js
DELETED
|
@@ -1,203 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* @module emoji/emojimention
|
|
7
|
-
*/
|
|
8
|
-
import { logWarning } from 'ckeditor5/src/utils.js';
|
|
9
|
-
import { Plugin } from 'ckeditor5/src/core.js';
|
|
10
|
-
import { Typing } from 'ckeditor5/src/typing.js';
|
|
11
|
-
import EmojiRepository from './emojirepository.js';
|
|
12
|
-
const EMOJI_MENTION_MARKER = ':';
|
|
13
|
-
const EMOJI_SHOW_ALL_OPTION_ID = ':__EMOJI_SHOW_ALL:';
|
|
14
|
-
const EMOJI_HINT_OPTION_ID = ':__EMOJI_HINT:';
|
|
15
|
-
/**
|
|
16
|
-
* The emoji mention plugin.
|
|
17
|
-
*
|
|
18
|
-
* Introduces the autocomplete of emojis while typing.
|
|
19
|
-
*/
|
|
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
|
-
/**
|
|
32
|
-
* @inheritDoc
|
|
33
|
-
*/
|
|
34
|
-
static get requires() {
|
|
35
|
-
return [EmojiRepository, Typing, 'Mention'];
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* @inheritDoc
|
|
39
|
-
*/
|
|
40
|
-
static get pluginName() {
|
|
41
|
-
return 'EmojiMention';
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* @inheritDoc
|
|
45
|
-
*/
|
|
46
|
-
static get isOfficialPlugin() {
|
|
47
|
-
return true;
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* @inheritDoc
|
|
51
|
-
*/
|
|
52
|
-
constructor(editor) {
|
|
53
|
-
super(editor);
|
|
54
|
-
this.editor.config.define('emoji', {
|
|
55
|
-
dropdownLimit: 6
|
|
56
|
-
});
|
|
57
|
-
this._emojiDropdownLimit = editor.config.get('emoji.dropdownLimit');
|
|
58
|
-
this._skinTone = editor.config.get('emoji.skinTone');
|
|
59
|
-
const mentionFeedsConfigs = editor.config.get('mention.feeds');
|
|
60
|
-
const mergeFieldsPrefix = editor.config.get('mergeFields.prefix');
|
|
61
|
-
const markerAlreadyUsed = mentionFeedsConfigs.some(config => config.marker === EMOJI_MENTION_MARKER);
|
|
62
|
-
const isMarkerUsedByMergeFields = mergeFieldsPrefix ? mergeFieldsPrefix[0] === EMOJI_MENTION_MARKER : false;
|
|
63
|
-
if (markerAlreadyUsed || isMarkerUsedByMergeFields) {
|
|
64
|
-
/**
|
|
65
|
-
* The `marker` in the `emoji` config is already used by other plugin configuration.
|
|
66
|
-
*
|
|
67
|
-
* @error emoji-config-marker-already-used
|
|
68
|
-
* @param {string} marker Used marker.
|
|
69
|
-
*/
|
|
70
|
-
logWarning('emoji-config-marker-already-used', { marker: EMOJI_MENTION_MARKER });
|
|
71
|
-
return;
|
|
72
|
-
}
|
|
73
|
-
this._setupMentionConfiguration(mentionFeedsConfigs);
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* @inheritDoc
|
|
77
|
-
*/
|
|
78
|
-
async init() {
|
|
79
|
-
const editor = this.editor;
|
|
80
|
-
this._emojiPickerPlugin = editor.plugins.has('EmojiPicker') ? editor.plugins.get('EmojiPicker') : null;
|
|
81
|
-
this._emojiRepositoryPlugin = editor.plugins.get('EmojiRepository');
|
|
82
|
-
// Skip overriding the `mention` command listener if the emoji repository is not ready.
|
|
83
|
-
if (!await this._emojiRepositoryPlugin.isReady()) {
|
|
84
|
-
return;
|
|
85
|
-
}
|
|
86
|
-
editor.once('ready', this._overrideMentionExecuteListener.bind(this));
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* Initializes the configuration for emojis in the mention feature.
|
|
90
|
-
*/
|
|
91
|
-
_setupMentionConfiguration(mentionFeedsConfigs) {
|
|
92
|
-
const emojiMentionFeedConfig = {
|
|
93
|
-
marker: EMOJI_MENTION_MARKER,
|
|
94
|
-
dropdownLimit: this._emojiDropdownLimit,
|
|
95
|
-
itemRenderer: this._customItemRendererFactory(this.editor.t),
|
|
96
|
-
feed: this._queryEmojiCallbackFactory()
|
|
97
|
-
};
|
|
98
|
-
this.editor.config.set('mention.feeds', [...mentionFeedsConfigs, emojiMentionFeedConfig]);
|
|
99
|
-
}
|
|
100
|
-
/**
|
|
101
|
-
* Returns the `itemRenderer()` callback for mention config.
|
|
102
|
-
*/
|
|
103
|
-
_customItemRendererFactory(t) {
|
|
104
|
-
return (item) => {
|
|
105
|
-
const itemElement = document.createElement('button');
|
|
106
|
-
itemElement.classList.add('ck');
|
|
107
|
-
itemElement.classList.add('ck-button');
|
|
108
|
-
itemElement.classList.add('ck-button_with-text');
|
|
109
|
-
itemElement.id = `mention-list-item-id${item.id.slice(0, -1)}`;
|
|
110
|
-
itemElement.type = 'button';
|
|
111
|
-
itemElement.tabIndex = -1;
|
|
112
|
-
const labelElement = document.createElement('span');
|
|
113
|
-
labelElement.classList.add('ck');
|
|
114
|
-
labelElement.classList.add('ck-button__label');
|
|
115
|
-
itemElement.appendChild(labelElement);
|
|
116
|
-
if (item.id === EMOJI_HINT_OPTION_ID) {
|
|
117
|
-
itemElement.classList.add('ck-list-item-button');
|
|
118
|
-
itemElement.classList.add('ck-disabled');
|
|
119
|
-
labelElement.textContent = t('Keep on typing to see the emoji.');
|
|
120
|
-
}
|
|
121
|
-
else if (item.id === EMOJI_SHOW_ALL_OPTION_ID) {
|
|
122
|
-
labelElement.textContent = t('Show all emoji...');
|
|
123
|
-
}
|
|
124
|
-
else {
|
|
125
|
-
labelElement.textContent = `${item.text} ${item.id}`;
|
|
126
|
-
}
|
|
127
|
-
return itemElement;
|
|
128
|
-
};
|
|
129
|
-
}
|
|
130
|
-
/**
|
|
131
|
-
* Overrides the default mention execute listener to insert an emoji as plain text instead.
|
|
132
|
-
*/
|
|
133
|
-
_overrideMentionExecuteListener() {
|
|
134
|
-
const editor = this.editor;
|
|
135
|
-
editor.commands.get('mention').on('execute', (event, data) => {
|
|
136
|
-
const eventData = data[0];
|
|
137
|
-
// Ignore non-emoji auto-complete actions.
|
|
138
|
-
if (eventData.marker !== EMOJI_MENTION_MARKER) {
|
|
139
|
-
return;
|
|
140
|
-
}
|
|
141
|
-
// Do not propagate the event.
|
|
142
|
-
event.stop();
|
|
143
|
-
// Do nothing when executing after selecting a hint message.
|
|
144
|
-
if (eventData.mention.id === EMOJI_HINT_OPTION_ID) {
|
|
145
|
-
return;
|
|
146
|
-
}
|
|
147
|
-
// Trigger the picker UI.
|
|
148
|
-
if (eventData.mention.id === EMOJI_SHOW_ALL_OPTION_ID) {
|
|
149
|
-
const text = [...eventData.range.getItems()]
|
|
150
|
-
.filter(item => item.is('$textProxy'))
|
|
151
|
-
.map(item => item.data)
|
|
152
|
-
.reduce((result, text) => result + text, '');
|
|
153
|
-
editor.model.change(writer => {
|
|
154
|
-
editor.model.deleteContent(writer.createSelection(eventData.range));
|
|
155
|
-
});
|
|
156
|
-
const emojiPickerPlugin = this._emojiPickerPlugin;
|
|
157
|
-
emojiPickerPlugin.showUI(text.slice(1));
|
|
158
|
-
setTimeout(() => {
|
|
159
|
-
emojiPickerPlugin.emojiPickerView.focus();
|
|
160
|
-
});
|
|
161
|
-
}
|
|
162
|
-
// Or insert the emoji to editor.
|
|
163
|
-
else {
|
|
164
|
-
editor.execute('insertText', {
|
|
165
|
-
text: eventData.mention.text,
|
|
166
|
-
range: eventData.range
|
|
167
|
-
});
|
|
168
|
-
}
|
|
169
|
-
}, { priority: 'high' });
|
|
170
|
-
}
|
|
171
|
-
/**
|
|
172
|
-
* Returns the `feed()` callback for mention config.
|
|
173
|
-
*/
|
|
174
|
-
_queryEmojiCallbackFactory() {
|
|
175
|
-
return (searchQuery) => {
|
|
176
|
-
// Do not show anything when a query starts with a space.
|
|
177
|
-
if (searchQuery.startsWith(' ')) {
|
|
178
|
-
return [];
|
|
179
|
-
}
|
|
180
|
-
const emojis = this._emojiRepositoryPlugin.getEmojiByQuery(searchQuery)
|
|
181
|
-
.map(emoji => {
|
|
182
|
-
let text = emoji.skins[this._skinTone] || emoji.skins.default;
|
|
183
|
-
if (this._emojiPickerPlugin) {
|
|
184
|
-
text = emoji.skins[this._emojiPickerPlugin.skinTone] || emoji.skins.default;
|
|
185
|
-
}
|
|
186
|
-
return {
|
|
187
|
-
id: `:${emoji.annotation}:`,
|
|
188
|
-
text
|
|
189
|
-
};
|
|
190
|
-
});
|
|
191
|
-
if (!this._emojiPickerPlugin) {
|
|
192
|
-
return emojis.slice(0, this._emojiDropdownLimit);
|
|
193
|
-
}
|
|
194
|
-
const actionItem = {
|
|
195
|
-
id: searchQuery.length > 1 ? EMOJI_SHOW_ALL_OPTION_ID : EMOJI_HINT_OPTION_ID
|
|
196
|
-
};
|
|
197
|
-
return [
|
|
198
|
-
...emojis.slice(0, this._emojiDropdownLimit - 1),
|
|
199
|
-
actionItem
|
|
200
|
-
];
|
|
201
|
-
};
|
|
202
|
-
}
|
|
203
|
-
}
|
package/src/emojipicker.d.ts
DELETED
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* @module emoji/emojipicker
|
|
7
|
-
*/
|
|
8
|
-
import { ContextualBalloon, Dialog } from 'ckeditor5/src/ui.js';
|
|
9
|
-
import { Plugin } from 'ckeditor5/src/core.js';
|
|
10
|
-
import { Typing } from 'ckeditor5/src/typing.js';
|
|
11
|
-
import EmojiRepository from './emojirepository.js';
|
|
12
|
-
import EmojiPickerView from './ui/emojipickerview.js';
|
|
13
|
-
import type { SkinToneId } from './emojiconfig.js';
|
|
14
|
-
import '../theme/emojipicker.css';
|
|
15
|
-
/**
|
|
16
|
-
* The emoji picker plugin.
|
|
17
|
-
*
|
|
18
|
-
* Introduces the `'emoji'` dropdown.
|
|
19
|
-
*/
|
|
20
|
-
export default class EmojiPicker extends Plugin {
|
|
21
|
-
/**
|
|
22
|
-
* The actions view displayed inside the balloon.
|
|
23
|
-
*/
|
|
24
|
-
emojiPickerView: EmojiPickerView | undefined;
|
|
25
|
-
/**
|
|
26
|
-
* The contextual balloon plugin instance.
|
|
27
|
-
*/
|
|
28
|
-
_balloonPlugin: ContextualBalloon;
|
|
29
|
-
/**
|
|
30
|
-
* An instance of the {@link module:emoji/emojirepository~EmojiRepository} plugin.
|
|
31
|
-
*/
|
|
32
|
-
private _emojiRepositoryPlugin;
|
|
33
|
-
/**
|
|
34
|
-
* @inheritDoc
|
|
35
|
-
*/
|
|
36
|
-
static get requires(): readonly [typeof EmojiRepository, typeof ContextualBalloon, typeof Dialog, typeof Typing];
|
|
37
|
-
/**
|
|
38
|
-
* @inheritDoc
|
|
39
|
-
*/
|
|
40
|
-
static get pluginName(): "EmojiPicker";
|
|
41
|
-
/**
|
|
42
|
-
* @inheritDoc
|
|
43
|
-
*/
|
|
44
|
-
static get isOfficialPlugin(): true;
|
|
45
|
-
/**
|
|
46
|
-
* @inheritDoc
|
|
47
|
-
*/
|
|
48
|
-
init(): Promise<void>;
|
|
49
|
-
/**
|
|
50
|
-
* @inheritDoc
|
|
51
|
-
*/
|
|
52
|
-
destroy(): void;
|
|
53
|
-
/**
|
|
54
|
-
* Represents an active skin tone. Its value depends on the emoji UI plugin.
|
|
55
|
-
*
|
|
56
|
-
* Before opening the UI for the first time, the returned value is read from the editor configuration.
|
|
57
|
-
* Otherwise, it reflects the user's intention.
|
|
58
|
-
*/
|
|
59
|
-
get skinTone(): SkinToneId;
|
|
60
|
-
/**
|
|
61
|
-
* Displays the balloon with the emoji picker.
|
|
62
|
-
*
|
|
63
|
-
* @param [searchValue=''] A default query used to filer the grid when opening the UI.
|
|
64
|
-
*/
|
|
65
|
-
showUI(searchValue?: string): void;
|
|
66
|
-
/**
|
|
67
|
-
* Creates a button for toolbar and menu bar that will show the emoji dialog.
|
|
68
|
-
*/
|
|
69
|
-
private _createButton;
|
|
70
|
-
/**
|
|
71
|
-
* Creates an instance of the `EmojiPickerView` class that represents an emoji balloon.
|
|
72
|
-
*/
|
|
73
|
-
private _createEmojiPickerView;
|
|
74
|
-
/**
|
|
75
|
-
* Hides the balloon with the emoji picker.
|
|
76
|
-
*/
|
|
77
|
-
private _hideUI;
|
|
78
|
-
/**
|
|
79
|
-
* Registers converters.
|
|
80
|
-
*/
|
|
81
|
-
private _setupConversion;
|
|
82
|
-
/**
|
|
83
|
-
* Returns positioning options for the {@link #_balloonPlugin}. They control the way the balloon is attached
|
|
84
|
-
* to the target element or selection.
|
|
85
|
-
*/
|
|
86
|
-
private _getBalloonPositionData;
|
|
87
|
-
/**
|
|
88
|
-
* Displays a fake visual selection when the contextual balloon is displayed.
|
|
89
|
-
*
|
|
90
|
-
* This adds an 'emoji-picker' marker into the document that is rendered as a highlight on selected text fragment.
|
|
91
|
-
*/
|
|
92
|
-
private _showFakeVisualSelection;
|
|
93
|
-
/**
|
|
94
|
-
* Hides the fake visual selection.
|
|
95
|
-
*/
|
|
96
|
-
private _hideFakeVisualSelection;
|
|
97
|
-
}
|