Allow option to not include title on emoji images.

This commit is contained in:
Guo Xiang Tan 2017-01-03 11:07:55 +08:00
parent ecb1078343
commit 1cf0401e26
2 changed files with 3 additions and 3 deletions

View File

@ -29,8 +29,8 @@ function emojiOptions() {
return { getURL: Discourse.getURLWithCDN, emojiSet: siteSettings.emoji_set }; return { getURL: Discourse.getURLWithCDN, emojiSet: siteSettings.emoji_set };
} }
export function emojiUnescape(string) { export function emojiUnescape(string, options) {
const opts = emojiOptions(); const opts = _.extend(emojiOptions(), options || {});
return opts ? performEmojiUnescape(string, opts) : string; return opts ? performEmojiUnescape(string, opts) : string;
} }

View File

@ -38,7 +38,7 @@ export function performEmojiUnescape(string, opts) {
const classes = isCustomEmoji(emojiVal, opts) ? "emoji emoji-custom" : "emoji"; const classes = isCustomEmoji(emojiVal, opts) ? "emoji emoji-custom" : "emoji";
return url && (isEmoticon || hasEndingColon) ? return url && (isEmoticon || hasEndingColon) ?
`<img src='${url}' title='${emojiVal}' alt='${emojiVal}' class='${classes}'>` : m; `<img src='${url}' ${opts.skipTitle ? '' : `title='${emojiVal}'`} alt='${emojiVal}' class='${classes}'>` : m;
}); });
} }