mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-12-06 02:59:29 +00:00
Use ckeditors emoji picker instead of our own plugin
This commit is contained in:
parent
e87720a838
commit
db1b91fc32
7 changed files with 19 additions and 26 deletions
1
assets/ckeditor/emojis.json
Normal file
1
assets/ckeditor/emojis.json
Normal file
File diff suppressed because one or more lines are too long
|
|
@ -63,7 +63,8 @@ import {EditorWatchdog} from 'ckeditor5';
|
|||
import {TodoList} from 'ckeditor5';
|
||||
|
||||
import ExtendedMarkdown from "./plugins/extendedMarkdown.js";
|
||||
import SpecialCharactersEmoji from "./plugins/special_characters_emoji";
|
||||
import SpecialCharactersGreek from "./plugins/special_characters_emoji";
|
||||
import {Mention, Emoji} from "ckeditor5";
|
||||
|
||||
class Editor extends ClassicEditor {}
|
||||
|
||||
|
|
@ -117,9 +118,11 @@ Editor.builtinPlugins = [
|
|||
Underline,
|
||||
TodoList,
|
||||
|
||||
Mention, Emoji,
|
||||
|
||||
//Our own extensions
|
||||
ExtendedMarkdown,
|
||||
SpecialCharactersEmoji
|
||||
SpecialCharactersGreek
|
||||
];
|
||||
|
||||
// Editor configuration.
|
||||
|
|
@ -148,6 +151,7 @@ Editor.defaultConfig = {
|
|||
'indent',
|
||||
'|',
|
||||
'specialCharacters',
|
||||
"emoji",
|
||||
'horizontalLine',
|
||||
'|',
|
||||
'imageUpload',
|
||||
|
|
|
|||
|
|
@ -27,10 +27,11 @@ import {Subscript} from 'ckeditor5';
|
|||
import {Superscript} from 'ckeditor5';
|
||||
import {Underline} from 'ckeditor5';
|
||||
import {EditorWatchdog} from 'ckeditor5';
|
||||
import {Mention, Emoji} from "ckeditor5";
|
||||
|
||||
import ExtendedMarkdownInline from "./plugins/extendedMarkdownInline";
|
||||
import SingleLinePlugin from "./plugins/singleLine";
|
||||
import SpecialCharactersEmoji from "./plugins/special_characters_emoji";
|
||||
import SpecialCharactersGreek from "./plugins/special_characters_emoji";
|
||||
|
||||
class Editor extends ClassicEditor {}
|
||||
|
||||
|
|
@ -62,7 +63,8 @@ Editor.builtinPlugins = [
|
|||
|
||||
ExtendedMarkdownInline,
|
||||
SingleLinePlugin,
|
||||
SpecialCharactersEmoji
|
||||
SpecialCharactersGreek,
|
||||
Mention, Emoji
|
||||
];
|
||||
|
||||
// Editor configuration.
|
||||
|
|
@ -81,6 +83,7 @@ Editor.defaultConfig = {
|
|||
'link',
|
||||
'code',
|
||||
'specialCharacters',
|
||||
'emoji',
|
||||
'|',
|
||||
'undo',
|
||||
'redo',
|
||||
|
|
|
|||
|
|
@ -22,9 +22,7 @@ import SpecialCharactersEssentials from 'ckeditor5';
|
|||
|
||||
import {Plugin} from 'ckeditor5';
|
||||
|
||||
const emoji = require('emoji.json');
|
||||
|
||||
export default class SpecialCharactersEmoji extends Plugin {
|
||||
export default class SpecialCharactersGreek extends Plugin {
|
||||
|
||||
init() {
|
||||
const editor = this.editor;
|
||||
|
|
@ -32,9 +30,6 @@ export default class SpecialCharactersEmoji extends Plugin {
|
|||
|
||||
//Add greek characters to special characters
|
||||
specialCharsPlugin.addItems('Greek', this.getGreek());
|
||||
|
||||
//Add Emojis to special characters
|
||||
specialCharsPlugin.addItems('Emoji', this.getEmojis());
|
||||
}
|
||||
|
||||
getGreek() {
|
||||
|
|
@ -96,14 +91,4 @@ export default class SpecialCharactersEmoji extends Plugin {
|
|||
{ title: 'san', character: 'Ϻ' },
|
||||
];
|
||||
}
|
||||
|
||||
getEmojis() {
|
||||
//Map our emoji data to the format the plugin expects
|
||||
return emoji.map(emoji => {
|
||||
return {
|
||||
title: emoji.name,
|
||||
character: emoji.char
|
||||
};
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,9 +52,15 @@ export default class extends Controller {
|
|||
|
||||
const language = document.body.dataset.locale ?? "en";
|
||||
|
||||
const emojiURL = new URL('../../ckeditor/emojis.json', import.meta.url).href;
|
||||
|
||||
const config = {
|
||||
language: language,
|
||||
licenseKey: "GPL",
|
||||
|
||||
emoji: {
|
||||
definitionsUrl: emojiURL
|
||||
}
|
||||
}
|
||||
|
||||
const watchdog = new EditorWatchdog();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue