Coder Social home page Coder Social logo

nodebb / nodebb-plugin-emoji Goto Github PK

View Code? Open in Web Editor NEW
11.0 12.0 30.0 4.41 MB

NodeBB Plugin enabling emoji as seen on http://www.emoji-cheat-sheet.com

License: MIT License

JavaScript 21.01% TypeScript 46.09% Smarty 4.55% Svelte 26.40% Shell 0.10% SCSS 1.85%

nodebb-plugin-emoji's Introduction

Emoji for NodeBB

Compatibility Downloads Dependency Status

Adds extensible emoji functionality to NodeBB

  • Multiple sets of emoji available for use
  • Intelligent auto-completion while composing posts and chat messages
  • Ability to convert common emoticons like :) to emoji
  • Convenient dialog to view and insert all available emoji
  • First-party support for custom emoji (available in the ACP)

Installation

For best results, install nodebb-plugin-emoji and emoji packs through the NodeBB Admin Panel.

Emoji packs

The following emoji packs are known to be compatible with nodebb-plugin-emoji

To add custom emoji, visit the Emoji ACP page and click on the pencil button in the bottom left.

Hook: filter:emoji.packs

In version two of the emoji plugin, a completely new API is now used to create emoji sets. Now, an emoji set defines its emojis via a hook that is emoitted by the emoji plugin when a build of emoji assets is run.

To use this, you must listen for the hook by adding it to plugin.json like so:

{
  "library": "emoji.js",
  "hooks": [
    { "hook": "filter:emoji.packs", "method": "defineEmoji" }
  ]
}

And then providing the defineEmoji function in your library file (emoji.js here):

exports.defineEmoji = function (data, callback) {
  data.packs.push({
    name: 'My Emoji Pack',
    id: 'my-emoji',
    attribution: '',
    path: __dirname,
    license: '',
    mode: 'images',
    images: {
      directory: 'emoji',
    },
    dictionary: {
      custom: {
        aliases: ['personalized'],
        image: 'custom.png',
        character: '',
      },
    },
  });

  callback(null, data);
};

In the above case, we define the emoji pack "My Emoji Pack" and one emoji: custom which has an alias of personalized, with an image named custom.png in the emoji directory. For full documentation, I suggest going to the interface definitions for Emoji and EmojiDefinition.

On an emoji build, initiated either on first install of the plugin or through the plugin ACP page, the emoji plugin will fire that hook and gather all emoji packs, then process them to produce metadata files it uses on the client side.

Manual installation

If nodebb-plugin-emoji is not available through the ACP, you can install it manually with NPM

npm install nodebb-plugin-emoji

nodebb-plugin-emoji's People

Contributors

artch avatar barisusakli avatar garyry avatar julianlam avatar nhlpl avatar pitaj avatar psychobunny avatar shlomocode avatar xeon999 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nodebb-plugin-emoji's Issues

Close window upon chat minimized / closed

Referencing new hooks added here: NodeBB/NodeBB#7805

In a similar manner to 0d144fb, kindly consider doing the same for chats, as follows:

In public/lib/emoji-dialog.ts line 153
Replace:
$(window).on('action:composer.discard action:composer.submit action:composer.minimize', close);

With:
$(window).on('action:composer.discard action:composer.submit action:composer.minimize action:chat.minimized action:chat.closed', close);

error after upgrading NodeBB 1.19.2

after upgrading to NodeBB 1.19.2 we got 100s of this error in the log:

2022-02-11T02:49:28.984Z [4567/24661] - �[31merror�[39m: [emoji] Failed to retrieve data for parse ENOENT: no such file or directory, open '/home/fsuzer/nodebb/node_modules/nodebb-plugin-emoji/build/emoji/table.json' {"code":"ENOENT","errno":-2,"path":"/home/fsuzer/nodebb/node_modules/nodebb-plugin-emoji/build/emoji/table.json","stack":"Error: ENOENT: no such file or directory, open '/home/fsuzer/nodebb/node_modules/nodebb-plugin-emoji/build/emoji/table.json'","syscall":"open"}
2022-02-11T02:49:28.986Z [4567/24661] - �[31merror�[39m: [emoji] Failed to retrieve data for parse ENOENT: no such file or directory, open '/home/fsuzer/nodebb/node_modules/nodebb-plugin-emoji/build/emoji/table.json' {"code":"ENOENT","errno":-2,"path":"/home/fsuzer/nodebb/node_modules/nodebb-plugin-emoji/build/emoji/table.json","stack":"Error: ENOENT: no such file or directory, open '/home/fsuzer/nodebb/node_modules/nodebb-plugin-emoji/build/emoji/table.json'","syscall":"open"}
2022-02-11T02:49:29.022Z [4567/24661] - �[31merror�[39m: [emoji] Failed to retrieve data for parse ENOENT: no such file or directory, open '/home/fsuzer/nodebb/node_modules/nodebb-plugin-emoji/build/emoji/table.json' {"code":"ENOENT","errno":-2,"path":"/home/fsuzer/nodebb/node_modules/nodebb-plugin-emoji/build/emoji/table.json","stack":"Error: ENOENT: no such file or directory, open '/home/fsuzer/nodebb/node_modules/nodebb-plugin-emoji/build/emoji/table.json'","syscall":"open"}
2022-02-11T02:49:29.023Z [4567/24661] - �[31merror�[39m: [emoji] Failed to retrieve data for parse ENOENT: no such file or directory, open '/home/fsuzer/nodebb/node_modules/nodebb-plugin-emoji/build/emoji/table.json' {"code":"ENOENT","errno":-2,"path":"/home/fsuzer/nodebb/node_modules/nodebb-plugin-emoji/build/emoji/table.json","stack":"Error: ENOENT: no such file or directory, open '/home/fsuzer/nodebb/node_modules/nodebb-plugin-emoji/build/emoji/table.json'","syscall":"open"}
2022-02-11T02:49:29.024Z [4567/24661] - �[31merror�[39m: [emoji] Failed to retrieve data for parse ENOENT: no such file or directory, open '/home/fsuzer/nodebb/node_modules/nodebb-plugin-emoji/build/emoji/table.json' {"code":"ENOENT","errno":-2,"path":"/home/fsuzer/nodebb/node_modules/nodebb-plugin-emoji/build/emoji/table.json","stack":"Error: ENOENT: no such file or directory, open '/home/fsuzer/nodebb/node_modules/nodebb-plugin-emoji/build/emoji/table.json'","syscall":"open"}
2022-02-11T02:49:29.024Z [4567/24661] - �[31merror�[39m: [emoji] Failed to retrieve data for parse ENOENT: no such file or directory, open '/home/fsuzer/nodebb/node_modules/nodebb-plugin-emoji/build/emoji/table.json' {"code":"ENOENT","errno":-2,"path":"/home/fsuzer/nodebb/node_modules/nodebb-plugin-emoji/build/emoji/table.json","stack":"Error: ENOENT: no such file or directory, open '/home/fsuzer/nodebb/node_modules/nodebb-plugin-emoji/build/emoji/table.json'","syscall":"open"}
2022-02-11T02:49:29.025Z [4567/24661] - �[31merror�[39m: [emoji] Failed to retrieve data for parse ENOENT: no such file or directory, open '/home/fsuzer/nodebb/node_modules/nodebb-plugin-emoji/build/emoji/table.json' {"code":"ENOENT","errno":-2,"path":"/home/fsuzer/nodebb/node_modules/nodebb-plugin-emoji/build/emoji/table.json","stack":"Error: ENOENT: no such file or directory, open '/home/fsuzer/nodebb/node_modules/nodebb-plugin-emoji/build/emoji/table.json'","syscall":"open"}

then, we reset the emoji plugin and rebuild the forum, normal emojis came back but ASCII characters are still not working, and the error above is gone and we have this error:

2022-02-11T02:52:32.682Z [4569/24935] - �[31merror�[39m: [plugins] Error executing 'static:app.load' in plugin 'nodebb-plugin-emoji'
TypeError: Config.global.get is not a function
    at Object.Config.user.get (/home/fsuzer/nodebb/node_modules/nodebb-plugin-shoutbox/lib/config.js:107:64)
    at Object.Shoutbox.settings.filterUserGetSettings [as method] (/home/fsuzer/nodebb/node_modules/nodebb-plugin-shoutbox/library.js:100:27)
    at fireMethod (/home/fsuzer/nodebb/src/plugins/hooks.js:137:25)
    at Object.fireFilterHook [as filter] (/home/fsuzer/nodebb/src/plugins/hooks.js:168:18)
    at Hooks.fire (/home/fsuzer/nodebb/src/plugins/hooks.js:105:49)
    at Object.wrapperCallback [as fire] (/home/fsuzer/nodebb/src/promisify.js:46:11)
    at onSettingsLoaded (/home/fsuzer/nodebb/src/user/settings.js:39:36)
    at User.getSettings (/home/fsuzer/nodebb/src/user/settings.js:15:17)
    at Object.wrapperCallback [as getSettings] (/home/fsuzer/nodebb/src/promisify.js:46:11)
    at Object.plugin.filterConfigGet [as method] (/home/fsuzer/nodebb/node_modules/nodebb-plugin-soundpack-default/index.js:14:34)

Can't upload images since 1.16.x

So.. I upgraded the forum to 1.16.0 today, and I started noticing the following when trying to upload an image with this emoji plugin:

Screenshot from 2020-12-18 18-52-50

Any idea what might be happening ?

Plugin is not working

Having this issue lately (I think since upgraded to 1.16.1),
Running;

  version:  1.16.2
  Node ver: v10.17.0
  git hash: 023e4cfcee208a0bae121a6e343a8c53009fd090
  database: mongo
        version: 4.0.13
        engine:  wiredTiger

The Plugin is not working at all, when opening the composer you get an error,

ERROR
Failed to load emoji metadata

Here is the log output I get when starting NodeBB;

error: [plugins] Error executing 'static:app.load' in plugin 'nodebb-plugin-emoji'
error: TypeError: Object.fromEntries is not a function
    at Object.getAll (/var/www/nodebb/node_modules/nodebb-plugin-emoji/build/lib/customizations.js:13:24)
    at process._tickCallback (internal/process/next_tick.js:68:7)
error: [emoji] Failed to retrieve data for parse ENOENT: no such file or directory, open '/var/www/nodebb/node_modules/nodebb-plugin-emoji/build/emoji/table.json' {"errno":-2,"code":"ENOENT","syscall":"open","path":"/var/www/nodebb/node_modules/nodebb-plugin-emoji/build/emoji/table.json","stack":"Error: ENOENT: no such file or directory, open '/var/www/nodebb/node_modules/nodebb-plugin-emoji/build/emoji/table.json'"}

Emojis button also in global chat

I would like to see the emoji button also in the global chat

Then when you send a message in global chat if you want you can add emoji

regards

image

Latest emoji library 3.3.0 yields syntax error

When I activate v3.3.0 of this library in my nodebb installation 1.13.2, I get the log messages below and the plugin isn't activated. The syntax error is not obviously related to the emoji library, but it disappears when I disable the plugin.

Apr 07 11:40:34 2020-04-07T09:40:34.353Z [4567/1111] - warn: [plugins] Unable to parse library for: nodebb-plugin-emoji
Apr 07 11:40:34 2020-04-07T09:40:34.355Z [4567/1111] - error: /run/nodebb/node_modules/fs-extra/lib/mkdirs/make-dir.js:86
Apr 07 11:40:34 } catch {
Apr 07 11:40:34 ^
Apr 07 11:40:34
Apr 07 11:40:34 SyntaxError: Unexpected token {
Apr 07 11:40:34 at createScript (vm.js:80:10)
Apr 07 11:40:34 at Object.runInThisContext (vm.js:139:10)
Apr 07 11:40:34 at Module._compile (module.js:617:28)
Apr 07 11:40:34 at Object.Module._extensions..js (module.js:664:10)
Apr 07 11:40:34 at Module.load (module.js:566:32)
Apr 07 11:40:34 at tryModuleLoad (module.js:506:12)
Apr 07 11:40:34 at Function.Module._load (module.js:498:3)
Apr 07 11:40:34 at Module.require (module.js:597:17)
Apr 07 11:40:34 at require (internal/module.js:11:18)
Apr 07 11:40:34 at Object.<anonymous> (/run/nodebb/node_modules/fs-extra/lib/mkdirs/index.js:3:44)

customize our own emojis

Is there a way for personalized emoji to come first?

For example, in the "custom" package, it goes much further back

I would like it to appear first as an option for emojis

I leave capture

image

I like the emojis that this package brings, but I would like the default emojis to be the personalized ones

Have the option that the emojis that the package brings are in the background

To be able to order which package of emojis go first

thank you

Issue with v1.8.2

When using this plugin with Version 1.8.2 the £ key and ' key result with :undefined:£:undefined: so there for if writing I've it comes out as I:undefined:':undefined:ve

ASCII characters not turning into emojis

After last update to nodebb v1.19.2 ASCII characters not turning into emojis.

I found this in logs.

2022-02-15T20:04:09.766Z [4568/49410] - ^[[31merror^[[39m: [plugins] Error executing 'static:app.load' in plugin 'nodebb-plugin-emoji'
TypeError: Cannot read properties of undefined (reading 'get')
    at Object.plugin.getConfig [as method] (/home/user_radforum/nodebb/node_modules/nodebb-plugin-recent-cards/library.js:68:26)
    at fireMethod (/home/user_radforum/nodebb/src/plugins/hooks.js:137:25)
    at Object.fireFilterHook [as filter] (/home/user_radforum/nodebb/src/plugins/hooks.js:168:18)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Hooks.fire (/home/user_radforum/nodebb/src/plugins/hooks.js:105:17)
    at async apiController.loadConfig (/home/user_radforum/nodebb/src/controllers/api.js:116:9)
    at async Object.getBaseUrl (/home/user_radforum/nodebb/node_modules/nodebb-plugin-emoji/build/lib/base-url.js:7:30)
    at async init (/home/user_radforum/nodebb/node_modules/nodebb-plugin-emoji/build/lib/index.js:40:21)
    at async Object.fireStaticHook [as static] (/home/user_radforum/nodebb/src/plugins/hooks.js:209:5)
    at async Hooks.fire (/home/user_radforum/nodebb/src/plugins/hooks.js:105:17)

My active plugins

2022-02-15T20:24:58.144Z [4568/49537] - verbose: [minifier] utilizing a maximum of 3 additional threads
Active plugins:
	* [email protected] (installed, enabled)
	* [email protected] (installed, enabled)
	* [email protected] (installed, enabled)
	* [email protected] (installed, enabled)
	* [email protected] (installed, enabled)
	* [email protected] (installed, enabled)
	* [email protected] (installed, enabled)
	* [email protected] (installed, enabled)
	* [email protected] (installed, enabled)
	* [email protected] (installed, enabled)
	* [email protected] (installed, enabled)
	* [email protected] (installed, disabled)
	* [email protected] (installed, enabled)
	* [email protected] (installed, enabled)
	* [email protected] (installed, enabled)
	* [email protected] (installed, disabled)
	* [email protected] (installed, enabled)
	* [email protected] (installed, disabled)
	* [email protected] (installed, disabled)
	* [email protected] (installed, enabled)

Breaks the space when used with markdown plugin

I do not know where the issue is. I am running NodeBB 1.10.1 + Markdown + Emoji.

Whenever I enable emoji plugin, the markdown plugin faces a weird issue where it eats the space separating the previous word and a markdown input. I'm not sure if I am able to explain it well in words. So, I'll just drop a screenshot for reference.

Image of Broken markdown

I've checked the HTML output and space is really eaten up. So, it is not a CSS issue as far as I can tell. No matter how much space I add between these, they all end up being eaten up.

Plugin does not seem to be working on NodeBB 1.14.2

I have just updated my forum to the latest version (1.14.2) and found that this plugin seems to be incompatible now. Due to an error that occurs whenever the composer is opened, it is no longer possible to create new posts or reply to existing ones. The following error is reported in the console:
error
I have disabled the plugin for now and that seems to have fixed the problem.

Additional information:
NodeBB version: 1.14.2
nodebb-plugin-emoji version: 3.3.2
I am using custom emojis.

Weird Error After 1.8.0

If I have the ASCII option checked, this plugin removes the space between any bold or italicized word and the previous word.

after nodebb update emoji to newest 2.2.5

open one post it reports
Failed to load emoji metadata
i have tried reinstall plugin, uninstall plugin , still have the save problem, it reports "failed to load emoji metadata"

no emoji are loaded

4/12 16:07:44 [11945] - error: /topic/26/the-funnies/1012
 Error: ENOENT: no such file or directory, open '/var/www/nodebb/forums/node_modules/nodebb-plugin-emoji/build/emoji/table.json'
    at Error (native)

I was able to resolve this manually with some black magic (stopping the service, manually reinstalling the emoji plugin from npm, building, starting the service, building assets in the admin panel, etc). BUT, these actions shouldn't be needed. I'd expect during an upgrade / install that the emoji are built properly with no admin effort.

Emojis ordered, most used first

It would be nice to be able to order our emojis for our convenience

There are emojis that are used more than other emojis

It would be good if the most used appear first and the least used appear below

or we can order them as we see fit

regards

Emojis are loading via HTTP instead of HTTPS

I have a nodebb instance running with HTTPS enabled. When loading posts with emojis, I get a chrome warning message for mixed-content.

Viewing the page resources I can see that the emoji plugin is loading the emojis via HTTP instead of HTTPS.

`emoji` class doesn't exist on all emoji

Hi!

Can you use a span instead of img node and add nodebb-emoji class on it? When you have a customized line height/font-size the emoji broke the style and we cannot resize/customize them without using a crappy hack.

Thank you!

Plugin assets aren't building

NodeBB Version - 1.12.1
nodebb-plugin-emoji version - 2.2.5

When running './nodebb build' NodeBB, the node-plugin-emoji (installed and activated) assets aren't being created. I end up with a folder and contents as follows:

  • nodebb website root
    • build
      • public
        • plugins
          • nodebb-plugin-emoji
            • emoji
              • avoid_npm_ignore
    • ...

That leaves me with errors, such as:

Refused to apply style from 'DOMAIN/plugins/nodebb-plugin-emoji/emoji/styles.css?v=k2vf88eesj0' because its MIME type ('text/plain') is not a supported stylesheet MIME type, and strict MIME checking is enabled.

When I follow the URL, there is not a stylesheet there.

Is there any reason why during a build an 'emoji' folder is created a populated with an empty file called 'avoid_npm_ignore'?

absolute symlinks for dirs android and customizations (should be relatives ?)

These dirs are absolute symlinks in nodebb-plugin-emoji and I think they should be relative (I need to remove/recreate them on every copy between my Prod and my Dev environments...) :

In nodebb/node_modules/nodebb-plugin-emoji/build/emoji :
android -> /home/myname/nodebb/node_modules/emoji-datasource-google/img/google/64
customizations -> /home/myname/nodebb/public/uploads/emoji

Is it possible to have these symlinks created relatives (to the nodebb or plugin dir) by your plugin ? Thanks.

change category labels to icons

No idea how to do this, so gonna issue.

Slack

image

Discord

image

NodeBB
image

It would take less space and get rid of the horizontal scrollbar.

The api cannot be called when the image is uploaded

error
Failed to upload file

2021-02-13T14:19:26.215Z [4567/12230] - error: /api/admin/plugins/emoji/upload
invalid csrf token
2021-02-13T14:19:26.221Z [4567/12230] - error: /api/admin/plugins/emoji/upload
invalid csrf token

Display Emoji dialog box in Quill

Hi @pitaj

When integrating this plugin with Quill, and pushing the "add icon" button, the plugin fails with:
emoji-dialog.js:149 Uncaught (in promise) TypeError: Cannot read property 'getBoundingClientRect' of undefined

To fix this, please add:

  1. Top of file:
    import { active as activeComposer } from 'composer';

  2. In toggle, update opener if quill is available:
    if ($('[data-uuid="' + composer_1.active + '"] .ql-container.ql-snow'))
    opener = document.querySelectorAll('button.ql-emoji-add-emoji')[0];

Just before:
var buttonRect = opener.getBoundingClientRect();

  1. In ./public/lib/types.d.ts
    Add:
    declare module 'composer' {
    export var active: string;
    }

Custom image emojis not loading in posts (domain is set to localhost)

I installed the plugin via the admin panel, then went to the emoji page and clicked the pencil and added a few emoji.

When I click emoji in the post editor, I see the custom emoji icons. I click and it adds the emoji code like :smile:, but then when I post it, the image does not load.

The url appears to be: https://localhost/plugins/nodebb-plugin-emoji/emoji/customizations/655dbdb4-4eaf-43b4-8030-82d0608f870f-ayy.png?v=kgfcrdm1id4

I'm not sure why, but it's setting the location to localhost, rather than my domain. If I change the url to my domain and load that in my browser it does work, so it's just that it's putting localhost that's the problem.

Inserting an emoji from search results yields :{../name}:

If I click on an emoji in the predefined categories (People, Nature, Food, ...), the emoji gets inserted correctly. If I search for a keyword and click on any of the found emoji in the "Search Results" tab, only :{../name}: is inserted. Looks like there's a replacement not working.

The problem exists with the latest versions available, NodeBB 1.10.0 and nodebb-plugin-emoji 2.2.3.

Emoji remove link images

Hi!

Currently when we use emoji the image is contained into a link. I've never seen this behavior before, can you disable it and/or add an option? This is confusiung for my users.

Thank you!

Skin tones modifier not working

We've had reports the modifier for skin tones isn't working. Instead of changing skin tone it shows the main emoji in yellow and then a block of skin tone next to it.

chrome_zvZ3T4iAfl

why load error when I add a emoji

image
There is a graph sign always on left of emoji, how to resolve this.

this is my package.json context

 "nodebb-plugin-emoji": "^5.0.5",
 "nodebb-plugin-emoji-android": "3.0.0",
 "nodebb-plugin-emoji-one": "^4.0.0",

Uncaught TypeError: t.context.getSelection

Hi Devs,
To reproduce: open quill, open emoji window (without embedding an icon), close quill.
next, open quill again.

The outcome: Uncaught TypeError: t.context.getSelection is not a function.
It seems that the emoji plugin tries to send something to quill, where quill has closed already.

Hiding the composer should also hide the emoji panel.

When you hide the topic composer, it should also hide the emoji panel.

  1. Open the composer. (make a new post or topic)
  2. Click on the emoji button.
  3. Click on the post button in the bottom right to hide the composer.

EF5387FF-C153-45A1-884A-7283C9CCF1F3
4B6B1E54-F15C-4E78-9856-B146E4DE614E
AC424C91-8021-4CFC-8700-C8F1D037D6BF

Emoji Plugin Does Nothing

We've installed the NEW emoji plugin as well as the -one emoji set several times. We've removed all old emoji packages. We've not had emoji working for many months. The NEW emoji plugin seems to do absolutely nothing except alter the "undefined" issue.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.