diff options
author | Christoph (Sheogorath) Kern | 2018-10-22 23:02:33 +0200 |
---|---|---|
committer | GitHub | 2018-10-22 23:02:33 +0200 |
commit | e115423d128ed2d0b2cf52a66f67031925bc11b7 (patch) | |
tree | e53b557c34f6291d0473cfd6b4f73ba3388f771d /public | |
parent | 26a65322a44aa2cc358ee9482f997915e8985cc0 (diff) | |
parent | 2063eb8bdf9c0537e9fcfadd7f587658c72bd281 (diff) |
Merge pull request #1006 from SISheogorath/fix/missingEmojis
Fix not rendered autocomplete emojis
Diffstat (limited to '')
-rw-r--r-- | public/js/extra.js | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/public/js/extra.js b/public/js/extra.js index dd264047..ddec31a8 100644 --- a/public/js/extra.js +++ b/public/js/extra.js @@ -1145,6 +1145,20 @@ const pdfPlugin = new Plugin( } ) +const emojijsPlugin = new Plugin( + // regexp to match emoji shortcodes :something: + /:([\d\D]*):/, + + (match, utils) => { + const emoji = match[1] ? match[1].toLowerCase() : undefined + if (window.emojify.emojiNames.includes(emoji)) { + const div = $(`<img class="emoji" src="${serverurl}/build/emojify.js/dist/images/basic/${emoji}.png"></img>`) + return div[0].outerHTML + } + return match[0] + } +) + // yaml meta, from https://github.com/eugeneware/remarkable-meta function get (state, line) { const pos = state.bMarks[line] @@ -1189,6 +1203,7 @@ function metaPlugin (md) { } md.use(metaPlugin) +md.use(emojijsPlugin) md.use(youtubePlugin) md.use(vimeoPlugin) md.use(gistPlugin) |