mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-08-02 01:04:41 +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
|
@ -63,6 +63,7 @@ import EditorWatchdog from '@ckeditor/ckeditor5-watchdog/src/editorwatchdog.js';
|
|||
import TodoList from '@ckeditor/ckeditor5-list/src/todolist';
|
||||
|
||||
import ExtendedMarkdown from "./plugins/extendedMarkdown.js";
|
||||
import SpecialCharactersEmoji from "./plugins/special_characters_emoji";
|
||||
|
||||
class Editor extends ClassicEditor {}
|
||||
|
||||
|
@ -115,7 +116,10 @@ Editor.builtinPlugins = [
|
|||
TableToolbar,
|
||||
Underline,
|
||||
TodoList,
|
||||
ExtendedMarkdown
|
||||
|
||||
//Our own extensions
|
||||
ExtendedMarkdown,
|
||||
SpecialCharactersEmoji
|
||||
];
|
||||
|
||||
// Editor configuration.
|
||||
|
|
|
@ -30,6 +30,7 @@ import EditorWatchdog from '@ckeditor/ckeditor5-watchdog/src/editorwatchdog.js';
|
|||
|
||||
import ExtendedMarkdownInline from "./plugins/extendedMarkdownInline";
|
||||
import SingleLinePlugin from "./plugins/singleLine";
|
||||
import SpecialCharactersEmoji from "./plugins/special_characters_emoji";
|
||||
|
||||
class Editor extends ClassicEditor {}
|
||||
|
||||
|
@ -61,6 +62,7 @@ Editor.builtinPlugins = [
|
|||
|
||||
ExtendedMarkdownInline,
|
||||
SingleLinePlugin,
|
||||
SpecialCharactersEmoji
|
||||
];
|
||||
|
||||
// Editor configuration.
|
||||
|
|
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