Skip to content

Commit e115423

Browse files
authored
Merge pull request #1006 from SISheogorath/fix/missingEmojis
Fix not rendered autocomplete emojis
2 parents 26a6532 + 2063eb8 commit e115423

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

public/js/extra.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1145,6 +1145,20 @@ const pdfPlugin = new Plugin(
11451145
}
11461146
)
11471147

1148+
const emojijsPlugin = new Plugin(
1149+
// regexp to match emoji shortcodes :something:
1150+
/:([\d\D]*):/,
1151+
1152+
(match, utils) => {
1153+
const emoji = match[1] ? match[1].toLowerCase() : undefined
1154+
if (window.emojify.emojiNames.includes(emoji)) {
1155+
const div = $(`<img class="emoji" src="${serverurl}/build/emojify.js/dist/images/basic/${emoji}.png"></img>`)
1156+
return div[0].outerHTML
1157+
}
1158+
return match[0]
1159+
}
1160+
)
1161+
11481162
// yaml meta, from https://github.com/eugeneware/remarkable-meta
11491163
function get (state, line) {
11501164
const pos = state.bMarks[line]
@@ -1189,6 +1203,7 @@ function metaPlugin (md) {
11891203
}
11901204

11911205
md.use(metaPlugin)
1206+
md.use(emojijsPlugin)
11921207
md.use(youtubePlugin)
11931208
md.use(vimeoPlugin)
11941209
md.use(gistPlugin)

0 commit comments

Comments
 (0)