Allow to switch between default and emoji-one emoji style

Этот коммит содержится в:
Florian Orben
2015-12-01 00:37:00 +01:00
родитель 2b2ee62a1d
Коммит c111777f85
4199 изменённых файлов: 1035 добавлений и 10 удалений

Просмотреть файл

@@ -1,6 +1,8 @@
// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import * as Utils from './utils.jsx';
const emoticonPatterns = {
smile: /(^|\s)(:-?\))(?=$|\s)/g, // :)
wink: /(^|\s)(;-?\))(?=$|\s)/g, // ;)
@@ -133,7 +135,7 @@ export function handleEmoticons(text, tokens) {
const alias = `MM_EMOTICON${index}`;
tokens.set(alias, {
value: `<img align="absmiddle" alt="${matchText}" class="emoji" src="${getImagePathForEmoticon(name)}" title="${matchText}" />`,
value: `<img align="absmiddle" alt="${matchText}" class="emoji" src="${Utils.getImagePathForEmoticon(name)}" title="${matchText}" />`,
originalText: fullMatch
});
@@ -154,6 +156,3 @@ export function handleEmoticons(text, tokens) {
return output;
}
function getImagePathForEmoticon(name) {
return `/static/images/emoji/${name}.png`;
}

Просмотреть файл

@@ -1227,3 +1227,12 @@ export function getPostTerm(post) {
export function isFeatureEnabled(feature) {
return PreferenceStore.getPreference(Constants.Preferences.CATEGORY_ADVANCED_SETTINGS, Constants.FeatureTogglePrefix + feature.label, {value: 'false'}).value === 'true';
}
export function getImagePathForEmoticon(name, style) {
const emojiStyle = style || PreferenceStore.getPreference(Constants.Preferences.CATEGORY_DISPLAY_SETTINGS, 'emoji_style', {value: 'default'}).value;
if (name) {
return `/static/images/emoji/${emojiStyle}/${name}.png`;
}
return `/static/images/emoji/${emojiStyle}`;
}