Init emoji v2

This commit is contained in:
Peter Jaszkowiak 2017-09-06 16:15:41 -06:00
commit 3094180be6
6 changed files with 246 additions and 0 deletions

63
.gitignore vendored Normal file
View file

@ -0,0 +1,63 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# Typescript v1 declaration files
typings/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env


# Custom ignores
build
.vscode

64
.npmignore Normal file
View file

@ -0,0 +1,64 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# Typescript v1 declaration files
typings/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env


# Custom ignores
.git
.gitignore
.vscode

21
LICENSE Normal file
View file

@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2017 NodeBB

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

40
README.md Normal file
View file

@ -0,0 +1,40 @@
# Emoji for NodeBB

![Compatibility](https://packages.nodebb.org/api/v1/plugins/nodebb-plugin-emoji/compatibility.png)
[![Downloads](https://img.shields.io/npm/dm/nodebb-plugin-emoji.svg)](https://www.npmjs.com/package/nodebb-plugin-emoji)
[![Dependency Status](https://david-dm.org/NodeBB-Community/nodebb-plugin-emoji.svg)](https://david-dm.org/NodeBB/nodebb-plugin-emoji)

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

## 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`

- [nodebb-plugin-emoji-one](https://github.com/NodeBB-Community/nodebb-plugin-emoji-one)
- [nodebb-plugin-emoji-apple](https://github.com/NodeBB-Community/nodebb-plugin-emoji-apple)
- [nodebb-plugin-emoji-cubicopp](https://github.com/NodeBB-Community/nodebb-plugin-emoji-cubicopp)

#### `emoji.js` / `emoji.json`

In version two of the emoji plugin, a completely new API is now used to create emoji sets. Now, an emoji set defines it's emojis in an `emoji` file in it's root directory.

This file can either be a simple JSON file defining the emoji pack, or it can be a Node module exporting a function. Both are expected to result in a schema defined in [lib/types.d.ts](lib/types.d.ts).

The `emoji.js` approach is useful when the pack needs to download assets, if it's easier to generate the dictionary on demand, or in any asynchronous situation.

On an emoji build, initiated either on first install of the plugin or through the plugin ACP page, the emoji plugin will look through **activated** plugins for an `emoji.js` or `emoji.json` file in the plugin root directory. It then requires the file from each matching plugin and does what is necessary to compile assets and metadata centrally.

### Manual installation

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

npm install nodebb-plugin-emoji

25
package.json Normal file
View file

@ -0,0 +1,25 @@
{
"name": "nodebb-plugin-emoji",
"version": "2.0.0",
"description": "Adds extensible emoji functionality to NodeBB",
"main": "build/lib",
"author": "Peter Jaszkowiak <p.jaszkow@gmail.com> (https://github.com/pitaj)",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/NodeBB/nodebb-plugin-emoji.git"
},
"nbbpm": {
"compatibility": "^1.6.0"
},
"keywords": [
"nodebb",
"plugin",
"emoji",
"extended"
],
"scripts": {
"compile": "tsc -p . && tsc -p public",
"build": "npm run compile && node ../nodebb/nodebb build --dev"
}
}

33
plugin.json Normal file
View file

@ -0,0 +1,33 @@
{
"library": "build/lib",
"less": [
"public/style.less"
],
"modules": {
"emoji-dialog.js": "build/public/lib/emoji-dialog.js",
"Fuse.js": "node_modules/fuse.js/dist/fuse.js"
},
"staticDirs": {
"emoji": "build/emoji"
},
"scripts": [
"build/public/lib/emoji.js"
],
"acpScripts": [
"public/admin.js"
],
"languages": "public/language",
"defaultLang": "en-US",
"templates": "public/templates",
"hooks": [
{ "hook": "static:app.load", "method": "init" },
{ "hook": "filter:admin.header.build", "method": "adminMenu" },
{ "hook": "filter:composer.formatting", "method": "composerFormatting", "priority": 19 },
{ "hook": "filter:parse.raw", "method": "parse.raw", "priority": 9 },
{ "hook": "filter:parse.post", "method": "parse.post", "priority": 9 },
{ "hook": "filter:email.modify", "method": "modifyEmail" },
{ "hook": "action:plugin.activate", "method": "plugins.activation" },
{ "hook": "action:plugin.deactivate", "method": "plugins.deactivation" },
{ "hook": "filter:meta.getLinkTags", "method": "addStylesheet" }
]
}