mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-07-08 17:34:32 +02:00
Add Emojis to Special Characters input of CKEDITOR
This commit is contained in:
parent
fdcfb95ac7
commit
41b1d8b59e
5 changed files with 39 additions and 1 deletions
26
assets/ckeditor/plugins/special_characters_emoji.js
Normal file
26
assets/ckeditor/plugins/special_characters_emoji.js
Normal file
|
@ -0,0 +1,26 @@
|
|||
import SpecialCharacters from '@ckeditor/ckeditor5-special-characters/src/specialcharacters';
|
||||
import SpecialCharactersEssentials from '@ckeditor/ckeditor5-special-characters/src/specialcharactersessentials';
|
||||
|
||||
import Plugin from '@ckeditor/ckeditor5-core/src/plugin';
|
||||
|
||||
const emoji = require('emoji.json');
|
||||
|
||||
export default class SpecialCharactersEmoji extends Plugin {
|
||||
|
||||
init() {
|
||||
const editor = this.editor;
|
||||
const specialCharsPlugin = editor.plugins.get('SpecialCharacters');
|
||||
|
||||
specialCharsPlugin.addItems('Emoji', this.getEmojis());
|
||||
}
|
||||
|
||||
getEmojis() {
|
||||
//Map our emoji data to the format the plugin expects
|
||||
return emoji.map(emoji => {
|
||||
return {
|
||||
title: emoji.name,
|
||||
character: emoji.char
|
||||
};
|
||||
});
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue