samclarke / SCEditor

A lightweight HTML and BBCode WYSIWYG editor
http://www.sceditor.com/
Other
643 stars 186 forks source link

Unicode Emoji Toolbox Plugin #956

Closed w8tcha closed 3 months ago

w8tcha commented 3 months ago

This PR is based on

https://github.com/samclarke/SCEditor/pull/947

This PR adds optional unicode emoji selector in toolbar as a Plugin. The existing emoticon support may not be fit for all use cases so now the user has option to use unicode emojies or image emoticons.

Use it by adding preferred emojies in SCEditor initialization:

sceditor.create(textarea, {
    format: 'bbcode',
    style: 'https://cdn.jsdelivr.net/npm/sceditor@3/minified/themes/content/default.min.css',
    emojis: ['😊', '❤️', '😄'],
        plugins: 'emojis'
});

280264010-358549f5-4611-4409-9514-768764366330

If there are no options set it loads the EmojiMart Picker

emojiMart

samclarke commented 3 months ago

Thanks for the PR, looks great! :+1:

The style tests were failing so I've added a commit to fix that as it's just changing spaces to tabs and adding a few extra spaces. Also adds a comment to tell ESLint that EmojiMart is a global variable.

Really need to change to using Prettier for the formatting so it can all be automated.

w8tcha commented 3 months ago

Thanks for adding it. I also send a pull request for the website documentation