FIX: Don't convert :) into Emoji when emojis or emoji shurtcuts are disabled

This commit is contained in:
Gerhard Schlager
2019-05-21 16:56:51 +02:00
parent e8799f0ba4
commit e224100023
8 changed files with 146 additions and 13 deletions

View File

@@ -235,7 +235,12 @@ module PrettyText
protect do
v8.eval(<<~JS)
__paths = #{paths_json};
__performEmojiUnescape(#{title.inspect}, { getURL: __getURL, emojiSet: #{set}, customEmoji: #{custom} });
__performEmojiUnescape(#{title.inspect}, {
getURL: __getURL,
emojiSet: #{set},
customEmoji: #{custom},
enableEmojiShortcuts: #{SiteSetting.enable_emoji_shortcuts}
});
JS
end
end
@@ -243,9 +248,11 @@ module PrettyText
def self.escape_emoji(title)
return unless title
replace_emoji_shortcuts = SiteSetting.enable_emoji && SiteSetting.enable_emoji_shortcuts
protect do
v8.eval(<<~JS)
__performEmojiEscape(#{title.inspect});
__performEmojiEscape(#{title.inspect}, { emojiShortcuts: #{replace_emoji_shortcuts} });
JS
end
end