@ckeditor/ckeditor5-emoji 0.0.0-nightly-20250129.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/CHANGELOG.md +4 -0
- package/LICENSE.md +28 -0
- package/README.md +31 -0
- package/build/emoji.js +4 -0
- package/ckeditor5-metadata.json +32 -0
- package/dist/index-content.css +4 -0
- package/dist/index-editor.css +111 -0
- package/dist/index.css +143 -0
- package/dist/index.css.map +1 -0
- package/dist/index.js +1477 -0
- package/dist/index.js.map +1 -0
- package/lang/contexts.json +24 -0
- package/package.json +67 -0
- package/src/augmentation.d.ts +24 -0
- package/src/augmentation.js +5 -0
- package/src/emoji.d.ts +32 -0
- package/src/emoji.js +38 -0
- package/src/emojicommand.d.ts +24 -0
- package/src/emojicommand.js +33 -0
- package/src/emojiconfig.d.ts +80 -0
- package/src/emojiconfig.js +5 -0
- package/src/emojimention.d.ts +68 -0
- package/src/emojimention.js +193 -0
- package/src/emojipicker.d.ts +97 -0
- package/src/emojipicker.js +255 -0
- package/src/emojirepository.d.ts +139 -0
- package/src/emojirepository.js +267 -0
- package/src/index.d.ts +14 -0
- package/src/index.js +13 -0
- package/src/ui/emojicategoriesview.d.ts +68 -0
- package/src/ui/emojicategoriesview.js +131 -0
- package/src/ui/emojigridview.d.ts +140 -0
- package/src/ui/emojigridview.js +183 -0
- package/src/ui/emojipickerview.d.ts +91 -0
- package/src/ui/emojipickerview.js +172 -0
- package/src/ui/emojisearchview.d.ts +51 -0
- package/src/ui/emojisearchview.js +89 -0
- package/src/ui/emojitoneview.d.ts +46 -0
- package/src/ui/emojitoneview.js +89 -0
- package/theme/emojicategories.css +29 -0
- package/theme/emojigrid.css +55 -0
- package/theme/emojipicker.css +32 -0
- package/theme/emojitone.css +21 -0
|
@@ -0,0 +1,89 @@
|
|
|
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/emojitoneview
|
|
7
|
+
*/
|
|
8
|
+
import { createDropdown, addListToDropdown, View, ViewModel } from 'ckeditor5/src/ui.js';
|
|
9
|
+
import { Collection } from 'ckeditor5/src/utils.js';
|
|
10
|
+
import '../../theme/emojitone.css';
|
|
11
|
+
/**
|
|
12
|
+
* A view responsible for selecting a skin tone for an emoji.
|
|
13
|
+
*/
|
|
14
|
+
export default class EmojiToneView extends View {
|
|
15
|
+
/**
|
|
16
|
+
* @inheritDoc
|
|
17
|
+
*/
|
|
18
|
+
constructor(locale, { skinTone, skinTones }) {
|
|
19
|
+
super(locale);
|
|
20
|
+
this.set('skinTone', skinTone);
|
|
21
|
+
this._skinTones = skinTones;
|
|
22
|
+
const t = locale.t;
|
|
23
|
+
const accessibleLabel = t('Select skin tone');
|
|
24
|
+
const dropdownView = createDropdown(locale);
|
|
25
|
+
const itemDefinitions = new Collection();
|
|
26
|
+
for (const { id, icon, tooltip } of this._skinTones) {
|
|
27
|
+
const def = {
|
|
28
|
+
type: 'button',
|
|
29
|
+
model: new ViewModel({
|
|
30
|
+
value: id,
|
|
31
|
+
label: icon,
|
|
32
|
+
ariaLabel: tooltip,
|
|
33
|
+
tooltip,
|
|
34
|
+
tooltipPosition: 'e',
|
|
35
|
+
role: 'menuitemradio',
|
|
36
|
+
withText: true,
|
|
37
|
+
// To improve accessibility, disconnect a button and its label connection so that screen
|
|
38
|
+
// readers can read the `[aria-label]` attribute directly from the more descriptive button.
|
|
39
|
+
ariaLabelledBy: undefined
|
|
40
|
+
})
|
|
41
|
+
};
|
|
42
|
+
def.model.bind('isOn').to(this, 'skinTone', value => value === id);
|
|
43
|
+
itemDefinitions.add(def);
|
|
44
|
+
}
|
|
45
|
+
addListToDropdown(dropdownView, itemDefinitions, {
|
|
46
|
+
ariaLabel: accessibleLabel,
|
|
47
|
+
role: 'menu'
|
|
48
|
+
});
|
|
49
|
+
dropdownView.buttonView.set({
|
|
50
|
+
label: this._getSkinTone().icon,
|
|
51
|
+
ariaLabel: accessibleLabel,
|
|
52
|
+
ariaLabelledBy: undefined,
|
|
53
|
+
isOn: false,
|
|
54
|
+
withText: true,
|
|
55
|
+
tooltip: accessibleLabel
|
|
56
|
+
});
|
|
57
|
+
this.dropdownView = dropdownView;
|
|
58
|
+
// Execute command when an item from the dropdown is selected.
|
|
59
|
+
this.listenTo(dropdownView, 'execute', evt => {
|
|
60
|
+
this.skinTone = evt.source.value;
|
|
61
|
+
});
|
|
62
|
+
dropdownView.buttonView.bind('label').to(this, 'skinTone', () => {
|
|
63
|
+
return this._getSkinTone().icon;
|
|
64
|
+
});
|
|
65
|
+
dropdownView.buttonView.bind('ariaLabel').to(this, 'skinTone', () => {
|
|
66
|
+
// Render a current state, but also what the dropdown does.
|
|
67
|
+
return `${this._getSkinTone().tooltip}, ${accessibleLabel}`;
|
|
68
|
+
});
|
|
69
|
+
this.setTemplate({
|
|
70
|
+
tag: 'div',
|
|
71
|
+
attributes: {
|
|
72
|
+
class: ['ck', 'ck-emoji__skin-tone']
|
|
73
|
+
},
|
|
74
|
+
children: [dropdownView]
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* @inheritDoc
|
|
79
|
+
*/
|
|
80
|
+
focus() {
|
|
81
|
+
this.dropdownView.buttonView.focus();
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Helper method for receiving an object describing the active skin tone.
|
|
85
|
+
*/
|
|
86
|
+
_getSkinTone() {
|
|
87
|
+
return this._skinTones.find(tone => tone.id === this.skinTone);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
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-emoji__categories-list {
|
|
7
|
+
display: flex;
|
|
8
|
+
justify-content: space-between;
|
|
9
|
+
margin: 0 var(--ck-spacing-large);
|
|
10
|
+
|
|
11
|
+
> .ck.ck-button.ck-button_with-text {
|
|
12
|
+
border-width: 0;
|
|
13
|
+
border-bottom-width: 2px;
|
|
14
|
+
border-bottom-style: solid;
|
|
15
|
+
border-bottom-color: transparent;
|
|
16
|
+
padding: 0;
|
|
17
|
+
font-size: var(--ck-font-size-big);
|
|
18
|
+
min-width: var(--ck-font-size-big);
|
|
19
|
+
min-height: var(--ck-font-size-big);
|
|
20
|
+
|
|
21
|
+
&.ck-emoji__category-item.ck-on {
|
|
22
|
+
border-bottom-color: var(--ck-color-base-active);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
> span {
|
|
26
|
+
margin: auto;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
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
|
+
:root {
|
|
7
|
+
--ck-emoji-grid-tile-size: 27px;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.ck.ck-emoji {
|
|
11
|
+
& .ck.ck-emoji__tiles {
|
|
12
|
+
max-width: 100%;
|
|
13
|
+
max-height: 265px;
|
|
14
|
+
|
|
15
|
+
overflow-y: auto;
|
|
16
|
+
overflow-x: hidden;
|
|
17
|
+
border-top: 1px solid var(--ck-color-base-border);
|
|
18
|
+
|
|
19
|
+
& .ck-emoji__grid {
|
|
20
|
+
display: grid;
|
|
21
|
+
grid-template-columns: repeat(auto-fill, minmax(var(--ck-emoji-grid-tile-size), 1fr));
|
|
22
|
+
margin: var(--ck-spacing-standard) var(--ck-spacing-large);
|
|
23
|
+
grid-gap: var(--ck-spacing-small);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
& .ck-emoji__tile {
|
|
27
|
+
width: var(--ck-emoji-grid-tile-size);
|
|
28
|
+
height: var(--ck-emoji-grid-tile-size);
|
|
29
|
+
min-width: var(--ck-emoji-grid-tile-size);
|
|
30
|
+
min-height: var(--ck-emoji-grid-tile-size);
|
|
31
|
+
font-size: 1.5em;
|
|
32
|
+
padding: 0;
|
|
33
|
+
transition: .2s ease box-shadow;
|
|
34
|
+
border: 0;
|
|
35
|
+
|
|
36
|
+
@media (prefers-reduced-motion: reduce) {
|
|
37
|
+
transition: none;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
&:focus:not(.ck-disabled),
|
|
41
|
+
&:hover:not(.ck-disabled) {
|
|
42
|
+
/* Disable the default .ck-button's border ring. */
|
|
43
|
+
border: 0;
|
|
44
|
+
box-shadow: inset 0 0 0 1px var(--ck-color-base-background), 0 0 0 2px var(--ck-color-focus-border);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/* Make sure the glyph is rendered in the center of the button */
|
|
48
|
+
& .ck-button__label {
|
|
49
|
+
line-height: var(--ck-emoji-grid-tile-size);
|
|
50
|
+
width: 100%;
|
|
51
|
+
text-align: center;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
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-emoji {
|
|
7
|
+
width: 320px;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.ck .ck.ck-emoji__search {
|
|
11
|
+
display: flex;
|
|
12
|
+
padding: var(--ck-spacing-large);
|
|
13
|
+
padding-bottom: var(--ck-spacing-medium);
|
|
14
|
+
justify-content: space-between;
|
|
15
|
+
align-items: center;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/*
|
|
19
|
+
* Classes used by the "fake visual selection" displayed in the content when an input
|
|
20
|
+
* in the emoji picker UI has focus (the browser does not render the native selection in this state).
|
|
21
|
+
*/
|
|
22
|
+
.ck .ck-fake-emoji-selection {
|
|
23
|
+
background: var(--ck-color-link-fake-selection);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/* A collapsed fake visual selection. */
|
|
27
|
+
.ck .ck-fake-emoji-selection_collapsed {
|
|
28
|
+
height: 100%;
|
|
29
|
+
border-right: 1px solid var(--ck-color-base-text);
|
|
30
|
+
margin-right: -1px;
|
|
31
|
+
outline: solid 1px hsla(0, 0%, 100%, .5);
|
|
32
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
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-emoji__skin-tone {
|
|
7
|
+
margin-left: var(--ck-spacing-standard);
|
|
8
|
+
|
|
9
|
+
> .ck.ck-dropdown {
|
|
10
|
+
|
|
11
|
+
.ck.ck-list__item {
|
|
12
|
+
min-width: 1em;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.ck-button.ck-dropdown__button {
|
|
16
|
+
.ck-button__label {
|
|
17
|
+
width: initial;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|