chore(ckeditor5/plugins): integrate emoji special characters

This commit is contained in:
Elian Doran 2025-05-03 17:14:18 +03:00
parent bf45720f21
commit afb987d4dd
No known key found for this signature in database
3 changed files with 34 additions and 23 deletions

View File

@ -1,19 +0,0 @@
export function SpecialCharactersEmoji( editor ) {
editor.plugins.get( 'SpecialCharacters' ).addItems( 'Emoji', [
{ title: 'smiley face', character: '😊' },
{ title: 'grinning face', character: '😄' },
{ title: 'grinning face with big eyes', character: '😃' },
{ title: 'grinning face with sweat', character: '😅' },
{ title: 'beaming face with smiling eyes', character: '😃' },
{ title: 'neutral face', character: '😐' },
{ title: 'rolling on the floor laughing', character: '🤣' },
{ title: 'face with tears of joy', character: '😂' },
{ title: 'heart', character: '❤️' },
{ title: 'hands pressed together', character: '🙏' },
{ title: 'thumbs up', character: '👍' },
{ title: 'rocket', character: '🚀' },
{ title: '100', character: '💯' },
{ title: 'wind blowing face', character: '🌬️' },
{ title: 'floppy disk', character: '💾' }
], { label: 'Emoji' } );
}

View File

@ -7,6 +7,7 @@ import StrikethroughAsDel from "./plugins/strikethrough_as_del.js";
import InternalLinkPlugin from "./plugins/internallink.js"; import InternalLinkPlugin from "./plugins/internallink.js";
import ReferenceLink from "./plugins/referencelink.js"; import ReferenceLink from "./plugins/referencelink.js";
import RemoveFormatLinksPlugin from "./plugins/remove_format_links.js"; import RemoveFormatLinksPlugin from "./plugins/remove_format_links.js";
import SpecialCharactersEmojiPlugin from "./plugins/special_characters_emoji.js";
const TRILIUM_PLUGINS: typeof Plugin[] = [ const TRILIUM_PLUGINS: typeof Plugin[] = [
CutToNotePlugin, CutToNotePlugin,
@ -15,10 +16,13 @@ const TRILIUM_PLUGINS: typeof Plugin[] = [
ReferenceLink, ReferenceLink,
UploadimagePlugin, UploadimagePlugin,
InternalLinkPlugin, InternalLinkPlugin,
RemoveFormatLinksPlugin RemoveFormatLinksPlugin,
SpecialCharactersEmojiPlugin
]; ];
export const COMMON_PLUGINS: typeof Plugin[] = [ export const COMMON_PLUGINS: typeof Plugin[] = [
...TRILIUM_PLUGINS,
// essentials package expanded to allow selectively disable Enter and ShiftEnter // essentials package expanded to allow selectively disable Enter and ShiftEnter
Clipboard, Enter, SelectAll, ShiftEnter, Typing, Undo, Clipboard, Enter, SelectAll, ShiftEnter, Typing, Undo,
CKFinderUploadAdapter, CKFinderUploadAdapter,
@ -69,7 +73,6 @@ export const COMMON_PLUGINS: typeof Plugin[] = [
RemoveFormat, RemoveFormat,
SpecialCharacters, SpecialCharacters,
SpecialCharactersEssentials, SpecialCharactersEssentials,
// SpecialCharactersEmoji,
FindAndReplace, FindAndReplace,
Mention, Mention,
// MarkdownImportPlugin, // MarkdownImportPlugin,
@ -88,8 +91,6 @@ export const COMMON_PLUGINS: typeof Plugin[] = [
// Mermaid, // Mermaid,
// Kbd, // Kbd,
// Admonition // Admonition
...TRILIUM_PLUGINS
]; ];
export const COMMON_SETTINGS = { }; export const COMMON_SETTINGS = { };

View File

@ -0,0 +1,29 @@
import { Plugin, SpecialCharacters } from "ckeditor5";
export default class SpecialCharactersEmojiPlugin extends Plugin {
static get requires() {
return [ SpecialCharacters ];
}
init() {
this.editor.plugins.get('SpecialCharacters').addItems('Emoji', [
{ title: 'smiley face', character: '😊' },
{ title: 'grinning face', character: '😄' },
{ title: 'grinning face with big eyes', character: '😃' },
{ title: 'grinning face with sweat', character: '😅' },
{ title: 'beaming face with smiling eyes', character: '😃' },
{ title: 'neutral face', character: '😐' },
{ title: 'rolling on the floor laughing', character: '🤣' },
{ title: 'face with tears of joy', character: '😂' },
{ title: 'heart', character: '❤️' },
{ title: 'hands pressed together', character: '🙏' },
{ title: 'thumbs up', character: '👍' },
{ title: 'rocket', character: '🚀' },
{ title: '100', character: '💯' },
{ title: 'wind blowing face', character: '🌬️' },
{ title: 'floppy disk', character: '💾' }
], { label: 'Emoji' });
}
}