Total Complexity | 3 |
Complexity/F | 1 |
Lines of Code | 26 |
Function Count | 3 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | /* |
||
20 | import SpecialCharacters from '@ckeditor/ckeditor5-special-characters/src/specialcharacters'; |
||
21 | import SpecialCharactersEssentials from '@ckeditor/ckeditor5-special-characters/src/specialcharactersessentials'; |
||
22 | |||
23 | import Plugin from '@ckeditor/ckeditor5-core/src/plugin'; |
||
24 | |||
25 | const emoji = require('emoji.json'); |
||
26 | |||
27 | export default class SpecialCharactersEmoji extends Plugin { |
||
28 | |||
29 | init() { |
||
30 | const editor = this.editor; |
||
31 | const specialCharsPlugin = editor.plugins.get('SpecialCharacters'); |
||
32 | |||
33 | specialCharsPlugin.addItems('Emoji', this.getEmojis()); |
||
34 | } |
||
35 | |||
36 | getEmojis() { |
||
37 | //Map our emoji data to the format the plugin expects |
||
38 | return emoji.map(emoji => { |
||
39 | return { |
||
40 | title: emoji.name, |
||
41 | character: emoji.char |
||
42 | }; |
||
43 | }); |
||
44 | } |
||
45 | } |