diff options
Diffstat (limited to 'client/components/main/editor.js')
-rwxr-xr-x | client/components/main/editor.js | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/client/components/main/editor.js b/client/components/main/editor.js index ea24f518..5987b772 100755 --- a/client/components/main/editor.js +++ b/client/components/main/editor.js @@ -4,6 +4,25 @@ Template.editor.onRendered(() => { autosize($textarea); $textarea.escapeableTextComplete([ + // Emoji + { + match: /\B:([\-+\w]*)$/, + search(term, callback) { + callback(Emoji.values.map((emoji) => { + return emoji.includes(term) ? emoji : null; + }).filter(Boolean)); + }, + template(value) { + const imgSrc = Emoji.baseImagePath + value; + const image = `<img src="${imgSrc}.png" />`; + return image + value; + }, + replace(value) { + return `:${value}:`; + }, + index: 1, + }, + // User mentions { match: /\B@([\w.]*)$/, |