diff options
| author | otofune <otofune@gmail.com> | 2017-02-28 20:33:27 +0000 |
|---|---|---|
| committer | otofune <otofune@gmail.com> | 2017-03-01 03:19:24 +0000 |
| commit | 67ea1498ff128e6121e9897aa7093107ccfacab6 (patch) | |
| tree | 66a639bf3a266a68cdd54f67255a270cd7dbc6de /src/common/text/elements | |
| parent | Fix type (diff) | |
| download | sharkey-67ea1498ff128e6121e9897aa7093107ccfacab6.tar.gz sharkey-67ea1498ff128e6121e9897aa7093107ccfacab6.tar.bz2 sharkey-67ea1498ff128e6121e9897aa7093107ccfacab6.zip | |
[common] text & [web] common > scripts > text compiler: support emoji
Diffstat (limited to 'src/common/text/elements')
| -rw-r--r-- | src/common/text/elements/emoji.js | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/common/text/elements/emoji.js b/src/common/text/elements/emoji.js new file mode 100644 index 0000000000..e24231a223 --- /dev/null +++ b/src/common/text/elements/emoji.js @@ -0,0 +1,14 @@ +/** + * Emoji + */ + +module.exports = text => { + const match = text.match(/^:[a-zA-Z0-9+-_]+:/); + if (!match) return null; + const emoji = match[0]; + return { + type: 'emoji', + content: emoji, + emoji: emoji.substr(1, emoji.length - 2) + }; +}; |